diff --git a/locales/index.d.ts b/locales/index.d.ts index e99b278c8c..8bc073d1e5 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -982,6 +982,7 @@ export interface Locale { "unassign": string; "color": string; "manageCustomEmojis": string; + "manageAvatarDecorations": string; "youCannotCreateAnymore": string; "cannotPerformTemporary": string; "cannotPerformTemporaryDescription": string; @@ -1575,6 +1576,7 @@ export interface Locale { "inviteLimitCycle": string; "inviteExpirationTime": string; "canManageCustomEmojis": string; + "canManageAvatarDecorations": string; "driveCapacity": string; "alwaysMarkNsfw": string; "pinMax": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 32877b806a..035cecd25a 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -979,6 +979,7 @@ assign: "アサイン" unassign: "アサインを解除" color: "色" manageCustomEmojis: "カスタム絵文字の管理" +manageAvatarDecorations: "アバターデコレーションの管理" youCannotCreateAnymore: "これ以上作成することはできません。" cannotPerformTemporary: "一時的に利用できません" cannotPerformTemporaryDescription: "操作回数が制限を超過するため一時的に利用できません。しばらく時間を置いてから再度お試しください。" @@ -1496,6 +1497,7 @@ _role: inviteLimitCycle: "招待コードの発行間隔" inviteExpirationTime: "招待コードの有効期限" canManageCustomEmojis: "カスタム絵文字の管理" + canManageAvatarDecorations: "アバターデコレーションの管理" driveCapacity: "ドライブ容量" alwaysMarkNsfw: "ファイルにNSFWを常に付与" pinMax: "ノートのピン留めの最大数" diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index ef05920d50..d6a414694a 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -32,6 +32,7 @@ export type RolePolicies = { inviteLimitCycle: number; inviteExpirationTime: number; canManageCustomEmojis: boolean; + canManageAvatarDecorations: boolean; canSearchNotes: boolean; canUseTranslator: boolean; canHideAds: boolean; @@ -57,6 +58,7 @@ export const DEFAULT_POLICIES: RolePolicies = { inviteLimitCycle: 60 * 24 * 7, inviteExpirationTime: 0, canManageCustomEmojis: false, + canManageAvatarDecorations: false, canSearchNotes: false, canUseTranslator: true, canHideAds: false, @@ -306,6 +308,7 @@ export class RoleService implements OnApplicationShutdown { inviteLimitCycle: calc('inviteLimitCycle', vs => Math.max(...vs)), inviteExpirationTime: calc('inviteExpirationTime', vs => Math.max(...vs)), canManageCustomEmojis: calc('canManageCustomEmojis', vs => vs.some(v => v === true)), + canManageAvatarDecorations: calc('canManageAvatarDecorations', vs => vs.some(v => v === true)), canSearchNotes: calc('canSearchNotes', vs => vs.some(v => v === true)), canUseTranslator: calc('canUseTranslator', vs => vs.some(v => v === true)), canHideAds: calc('canHideAds', vs => vs.some(v => v === true)), diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts index c1869b141a..ec143fcb53 100644 --- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts @@ -11,7 +11,7 @@ export const meta = { tags: ['admin'], requireCredential: true, - requireModerator: true, + requireRolePolicy: 'canManageAvatarDecorations', } as const; export const paramDef = { diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts index 5aba24b426..6f1f386871 100644 --- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts @@ -13,8 +13,7 @@ export const meta = { tags: ['admin'], requireCredential: true, - requireModerator: true, - + requireRolePolicy: 'canManageAvatarDecorations', errors: { }, } as const; diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts index 9a32a59081..d9c669377d 100644 --- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts @@ -16,7 +16,7 @@ export const meta = { tags: ['admin'], requireCredential: true, - requireModerator: true, + requireRolePolicy: 'canManageAvatarDecorations', res: { type: 'array', diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts index 564014a3df..5ea9a40762 100644 --- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts @@ -13,7 +13,7 @@ export const meta = { tags: ['admin'], requireCredential: true, - requireModerator: true, + requireRolePolicy: 'canManageAvatarDecorations', errors: { }, diff --git a/packages/frontend/src/const.ts b/packages/frontend/src/const.ts index 3998df9efe..b3071fd924 100644 --- a/packages/frontend/src/const.ts +++ b/packages/frontend/src/const.ts @@ -66,6 +66,7 @@ export const ROLE_POLICIES = [ 'inviteLimitCycle', 'inviteExpirationTime', 'canManageCustomEmojis', + 'canManageAvatarDecorations', 'canSearchNotes', 'canUseTranslator', 'canHideAds', diff --git a/packages/frontend/src/pages/admin/index.vue b/packages/frontend/src/pages/admin/index.vue index b304edbf57..2bb1e80c18 100644 --- a/packages/frontend/src/pages/admin/index.vue +++ b/packages/frontend/src/pages/admin/index.vue @@ -118,7 +118,7 @@ const menuDef = $computed(() => [{ }, { icon: 'ti ti-sparkles', text: i18n.ts.avatarDecorations, - to: '/admin/avatar-decorations', + to: '/avatar-decorations', active: currentPage?.route.name === 'avatarDecorations', }, { icon: 'ti ti-whirl', diff --git a/packages/frontend/src/pages/admin/roles.editor.vue b/packages/frontend/src/pages/admin/roles.editor.vue index 89dd7d4c7c..1db99e61f4 100644 --- a/packages/frontend/src/pages/admin/roles.editor.vue +++ b/packages/frontend/src/pages/admin/roles.editor.vue @@ -259,6 +259,26 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts._role._options.canManageAvatarDecorations }} + + {{ i18n.ts._role.useBaseValue }} + {{ role.policies.canManageAvatarDecorations.value ? i18n.ts.yes : i18n.ts.no }} + + + + + {{ i18n.ts._role.useBaseValue }} + + + {{ i18n.ts.enable }} + + + {{ i18n.ts._role.priority }} + + + + {{ i18n.ts._role._options.canSearchNotes }} diff --git a/packages/frontend/src/pages/admin/roles.vue b/packages/frontend/src/pages/admin/roles.vue index 74de9f7396..d3f3773564 100644 --- a/packages/frontend/src/pages/admin/roles.vue +++ b/packages/frontend/src/pages/admin/roles.vue @@ -79,6 +79,14 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts._role._options.canManageAvatarDecorations }} + {{ policies.canManageAvatarDecorations ? i18n.ts.yes : i18n.ts.no }} + + {{ i18n.ts.enable }} + + + {{ i18n.ts._role._options.canManageCustomEmojis }} {{ policies.canManageCustomEmojis ? i18n.ts.yes : i18n.ts.no }} diff --git a/packages/frontend/src/pages/admin/avatar-decorations.vue b/packages/frontend/src/pages/avatar-decorations.vue similarity index 96% rename from packages/frontend/src/pages/admin/avatar-decorations.vue rename to packages/frontend/src/pages/avatar-decorations.vue index b4007e6d20..715f234493 100644 --- a/packages/frontend/src/pages/admin/avatar-decorations.vue +++ b/packages/frontend/src/pages/avatar-decorations.vue @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -35,7 +35,6 @@ SPDX-License-Identifier: AGPL-3.0-only