diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-09-01 14:02:14 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-09-01 14:02:14 +0900 |
| commit | 959e72b2b34968d9b3188776cf2843a2f69bf8b2 (patch) | |
| tree | 5cf8d966559a86161e706beb2abaf572ead10f7b | |
| parent | refactor (diff) | |
| download | misskey-959e72b2b34968d9b3188776cf2843a2f69bf8b2.tar.gz misskey-959e72b2b34968d9b3188776cf2843a2f69bf8b2.tar.bz2 misskey-959e72b2b34968d9b3188776cf2843a2f69bf8b2.zip | |
refactor
| -rw-r--r-- | packages/backend/src/core/RoleService.ts | 1 | ||||
| -rw-r--r-- | packages/backend/src/models/Notification.ts | 1 | ||||
| -rw-r--r-- | packages/frontend-shared/js/const.ts | 62 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkNotificationSelectWindow.vue | 2 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkServerSetupWizard.vue | 1 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkStreamingNotificationsTimeline.vue | 2 | ||||
| -rw-r--r-- | packages/frontend/src/pages/admin/roles.editor.vue | 5 | ||||
| -rw-r--r-- | packages/frontend/src/pages/admin/roles.vue | 6 | ||||
| -rw-r--r-- | packages/frontend/src/pages/notifications.vue | 2 | ||||
| -rw-r--r-- | packages/frontend/src/pages/settings/notifications.vue | 2 | ||||
| -rw-r--r-- | packages/frontend/src/widgets/WidgetNotifications.vue | 2 | ||||
| -rw-r--r-- | packages/misskey-js/src/consts.ts | 62 | ||||
| -rw-r--r-- | packages/misskey-js/src/index.ts | 1 |
13 files changed, 75 insertions, 74 deletions
diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index 3df7ee69ee..7dc07ef4dd 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -31,6 +31,7 @@ import { FanoutTimelineService } from '@/core/FanoutTimelineService.js'; import { NotificationService } from '@/core/NotificationService.js'; import type { OnApplicationShutdown, OnModuleInit } from '@nestjs/common'; +// misskey-js の rolePolicies と同期すべし export type RolePolicies = { gtlAvailable: boolean; ltlAvailable: boolean; diff --git a/packages/backend/src/models/Notification.ts b/packages/backend/src/models/Notification.ts index 5764a307b0..0b4eeb3455 100644 --- a/packages/backend/src/models/Notification.ts +++ b/packages/backend/src/models/Notification.ts @@ -10,6 +10,7 @@ import { MiAccessToken } from './AccessToken.js'; import { MiRole } from './Role.js'; import { MiDriveFile } from './DriveFile.js'; +// misskey-js の notificationTypes と同期すべし export type MiNotification = { type: 'note'; id: string; diff --git a/packages/frontend-shared/js/const.ts b/packages/frontend-shared/js/const.ts index b2d83fff8b..c8c437afe9 100644 --- a/packages/frontend-shared/js/const.ts +++ b/packages/frontend-shared/js/const.ts @@ -54,68 +54,6 @@ https://github.com/sindresorhus/file-type/blob/main/core.js https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers */ -export const notificationTypes = [ - 'note', - 'follow', - 'mention', - 'reply', - 'renote', - 'quote', - 'reaction', - 'pollEnded', - 'receiveFollowRequest', - 'followRequestAccepted', - 'roleAssigned', - 'chatRoomInvitationReceived', - 'achievementEarned', - 'exportCompleted', - 'login', - 'createToken', - 'test', - 'app', -] as const; -export const obsoleteNotificationTypes = ['pollVote', 'groupInvited'] as const; - -export const ROLE_POLICIES = [ - 'gtlAvailable', - 'ltlAvailable', - 'canPublicNote', - 'mentionLimit', - 'canInvite', - 'inviteLimit', - 'inviteLimitCycle', - 'inviteExpirationTime', - 'canManageCustomEmojis', - 'canManageAvatarDecorations', - 'canSearchNotes', - 'canSearchUsers', - 'canUseTranslator', - 'canHideAds', - 'driveCapacityMb', - 'maxFileSizeMb', - 'alwaysMarkNsfw', - 'canUpdateBioMedia', - 'pinLimit', - 'antennaLimit', - 'wordMuteLimit', - 'webhookLimit', - 'clipLimit', - 'noteEachClipsLimit', - 'userListLimit', - 'userEachUserListsLimit', - 'rateLimitFactor', - 'avatarDecorationLimit', - 'canImportAntennas', - 'canImportBlocking', - 'canImportFollowing', - 'canImportMuting', - 'canImportUserLists', - 'chatAvailability', - 'uploadableFileTypes', - 'noteDraftLimit', - 'watermarkAvailable', -] as const; - export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'border', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby', 'unixtime']; export const MFM_PARAMS: Record<typeof MFM_TAGS[number], string[]> = { tada: ['speed=', 'delay='], diff --git a/packages/frontend/src/components/MkNotificationSelectWindow.vue b/packages/frontend/src/components/MkNotificationSelectWindow.vue index bb01a008bd..7205e516d2 100644 --- a/packages/frontend/src/components/MkNotificationSelectWindow.vue +++ b/packages/frontend/src/components/MkNotificationSelectWindow.vue @@ -31,7 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { ref, useTemplateRef } from 'vue'; -import { notificationTypes } from '@@/js/const.js'; +import { notificationTypes } from 'misskey-js'; import MkSwitch from './MkSwitch.vue'; import MkInfo from './MkInfo.vue'; import MkButton from './MkButton.vue'; diff --git a/packages/frontend/src/components/MkServerSetupWizard.vue b/packages/frontend/src/components/MkServerSetupWizard.vue index 5120d7541b..8e3b41e754 100644 --- a/packages/frontend/src/components/MkServerSetupWizard.vue +++ b/packages/frontend/src/components/MkServerSetupWizard.vue @@ -191,7 +191,6 @@ SPDX-License-Identifier: AGPL-3.0-only <script setup lang="ts"> import { computed, ref } from 'vue'; import * as Misskey from 'misskey-js'; -import { ROLE_POLICIES } from '@@/js/const.js'; import MkButton from '@/components/MkButton.vue'; import MkInput from '@/components/MkInput.vue'; import * as os from '@/os.js'; diff --git a/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue b/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue index 15e8e2105f..6ee2e347a5 100644 --- a/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue +++ b/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue @@ -44,10 +44,10 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { onUnmounted, onMounted, computed, useTemplateRef, TransitionGroup, markRaw, watch } from 'vue'; import * as Misskey from 'misskey-js'; +import { notificationTypes } from 'misskey-js'; import { useInterval } from '@@/js/use-interval.js'; import { useDocumentVisibility } from '@@/js/use-document-visibility.js'; import { getScrollContainer, scrollToTop } from '@@/js/scroll.js'; -import type { notificationTypes } from '@@/js/const.js'; import XNotification from '@/components/MkNotification.vue'; import MkNote from '@/components/MkNote.vue'; import { useStream } from '@/stream.js'; diff --git a/packages/frontend/src/pages/admin/roles.editor.vue b/packages/frontend/src/pages/admin/roles.editor.vue index bb96a1cde1..e98b4f0129 100644 --- a/packages/frontend/src/pages/admin/roles.editor.vue +++ b/packages/frontend/src/pages/admin/roles.editor.vue @@ -828,8 +828,9 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { watch, ref, computed } from 'vue'; import { throttle } from 'throttle-debounce'; -import { ROLE_POLICIES } from '@@/js/const.js'; +import * as Misskey from 'misskey-js'; import RolesEditorFormula from './RolesEditorFormula.vue'; +import type { GetMkSelectValueTypesFromDef, MkSelectItem } from '@/components/MkSelect.vue'; import MkInput from '@/components/MkInput.vue'; import MkColorInput from '@/components/MkColorInput.vue'; import MkSelect from '@/components/MkSelect.vue'; @@ -854,7 +855,7 @@ const props = defineProps<{ const role = ref(deepClone(props.modelValue)); // fill missing policy -for (const ROLE_POLICY of ROLE_POLICIES) { +for (const ROLE_POLICY of Misskey.rolePolicies) { if (role.value.policies[ROLE_POLICY] == null) { role.value.policies[ROLE_POLICY] = { useDefault: true, diff --git a/packages/frontend/src/pages/admin/roles.vue b/packages/frontend/src/pages/admin/roles.vue index efdf8620ef..5323d042cf 100644 --- a/packages/frontend/src/pages/admin/roles.vue +++ b/packages/frontend/src/pages/admin/roles.vue @@ -331,7 +331,7 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { computed, reactive, ref } from 'vue'; -import { ROLE_POLICIES } from '@@/js/const.js'; +import * as Misskey from 'misskey-js'; import MkInput from '@/components/MkInput.vue'; import MkFolder from '@/components/MkFolder.vue'; import MkSwitch from '@/components/MkSwitch.vue'; @@ -353,8 +353,8 @@ const baseRoleQ = ref(''); const roles = await misskeyApi('admin/roles/list'); -const policies = reactive<Record<typeof ROLE_POLICIES[number], any>>({}); -for (const ROLE_POLICY of ROLE_POLICIES) { +const policies = reactive<Record<typeof Misskey.rolePolicies[number], any>>({}); +for (const ROLE_POLICY of Misskey.rolePolicies) { policies[ROLE_POLICY] = instance.policies[ROLE_POLICY]; } diff --git a/packages/frontend/src/pages/notifications.vue b/packages/frontend/src/pages/notifications.vue index 71c957460c..5d308e6b29 100644 --- a/packages/frontend/src/pages/notifications.vue +++ b/packages/frontend/src/pages/notifications.vue @@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { computed, markRaw, ref } from 'vue'; -import { notificationTypes } from '@@/js/const.js'; +import { notificationTypes } from 'misskey-js'; import MkStreamingNotificationsTimeline from '@/components/MkStreamingNotificationsTimeline.vue'; import MkNotesTimeline from '@/components/MkNotesTimeline.vue'; import * as os from '@/os.js'; diff --git a/packages/frontend/src/pages/settings/notifications.vue b/packages/frontend/src/pages/settings/notifications.vue index 84ecc23e84..64d61c0bee 100644 --- a/packages/frontend/src/pages/settings/notifications.vue +++ b/packages/frontend/src/pages/settings/notifications.vue @@ -65,7 +65,7 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { useTemplateRef, computed } from 'vue'; -import { notificationTypes } from '@@/js/const.js'; +import { notificationTypes } from 'misskey-js'; import XNotificationConfig from './notifications.notification-config.vue'; import type { NotificationConfig } from './notifications.notification-config.vue'; import FormLink from '@/components/form/link.vue'; diff --git a/packages/frontend/src/widgets/WidgetNotifications.vue b/packages/frontend/src/widgets/WidgetNotifications.vue index 8fb7968238..b588bcb029 100644 --- a/packages/frontend/src/widgets/WidgetNotifications.vue +++ b/packages/frontend/src/widgets/WidgetNotifications.vue @@ -17,8 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { defineAsyncComponent } from 'vue'; -import type { notificationTypes as notificationTypes_typeReferenceOnly } from '@@/js/const.js'; import { useWidgetPropsManager } from './widget.js'; +import type { notificationTypes as notificationTypes_typeReferenceOnly } from 'misskey-js'; import type { WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js'; import type { FormWithDefault, GetFormResultType } from '@/utility/form.js'; import MkContainer from '@/components/MkContainer.vue'; diff --git a/packages/misskey-js/src/consts.ts b/packages/misskey-js/src/consts.ts index 5cc725d3dd..9afd1f8be6 100644 --- a/packages/misskey-js/src/consts.ts +++ b/packages/misskey-js/src/consts.ts @@ -17,7 +17,27 @@ import type { ChatRoom, } from './autogen/models.js'; -export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'roleAssigned', 'chatRoomInvitationReceived', 'achievementEarned'] as const; +export const notificationTypes = [ + 'note', + 'follow', + 'mention', + 'reply', + 'renote', + 'quote', + 'reaction', + 'pollEnded', + 'receiveFollowRequest', + 'followRequestAccepted', + 'groupInvited', + 'app', + 'roleAssigned', + 'chatRoomInvitationReceived', + 'achievementEarned', + 'exportCompleted', + 'test', + 'login', + 'createToken', +] as const; export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const; @@ -170,6 +190,46 @@ export const moderationLogTypes = [ 'updateProxyAccountDescription', ] as const; +export const rolePolicies = [ + 'gtlAvailable', + 'ltlAvailable', + 'canPublicNote', + 'mentionLimit', + 'canInvite', + 'inviteLimit', + 'inviteLimitCycle', + 'inviteExpirationTime', + 'canManageCustomEmojis', + 'canManageAvatarDecorations', + 'canSearchNotes', + 'canSearchUsers', + 'canUseTranslator', + 'canHideAds', + 'driveCapacityMb', + 'maxFileSizeMb', + 'alwaysMarkNsfw', + 'canUpdateBioMedia', + 'pinLimit', + 'antennaLimit', + 'wordMuteLimit', + 'webhookLimit', + 'clipLimit', + 'noteEachClipsLimit', + 'userListLimit', + 'userEachUserListsLimit', + 'rateLimitFactor', + 'avatarDecorationLimit', + 'canImportAntennas', + 'canImportBlocking', + 'canImportFollowing', + 'canImportMuting', + 'canImportUserLists', + 'chatAvailability', + 'uploadableFileTypes', + 'noteDraftLimit', + 'watermarkAvailable', +] as const; + export const queueTypes = [ 'system', 'endedPollNotification', diff --git a/packages/misskey-js/src/index.ts b/packages/misskey-js/src/index.ts index bf32c37786..7bcb6f7746 100644 --- a/packages/misskey-js/src/index.ts +++ b/packages/misskey-js/src/index.ts @@ -13,6 +13,7 @@ export const mutedNoteReasons = consts.mutedNoteReasons; export const followingVisibilities = consts.followingVisibilities; export const followersVisibilities = consts.followersVisibilities; export const moderationLogTypes = consts.moderationLogTypes; +export const rolePolicies = consts.rolePolicies; export const queueTypes = consts.queueTypes; export const reversiUpdateKeys = consts.reversiUpdateKeys; |