diff --git a/locales/en-US.yml b/locales/en-US.yml
index 6e1c33232..829d577c5 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -2170,7 +2170,7 @@ _feeds:
emojiModPerm: "Custom emoji management"
emojiModPermDescription: "Add: Allow this user to add new custom emojis and to set tag/category/license to newly added custom emojis.\nAdd and Edit: \"Add\" Permission + Allow this user to edit the name/category/tag/license of the existing custom emojis.\nAllow All: \"Add and Edit\" Permission + Allow this user to delete existing custom emojis."
_emojiModPerm:
- none: "Deny All"
+ unauthorized: "Deny All"
add: "Add"
mod: "Add and Edit"
full: "Allow All"
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index bbe07c23f..f0970cd40 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -2004,7 +2004,7 @@ confirm: "確認"
emojiModPerm: "カスタム絵文字の管理"
emojiModPermDescription: "追加: カスタム絵文字の新規追加と新規追加されたカスタム絵文字(正確には、タグとカテゴリとライセンスが設定されていないカスタム絵文字)へのタグとカテゴリとライセンスの設定を許可します。\n追加と変更:「追加」の権限に加え、既存の絵文字の名前・カテゴリ・タグ・ライセンスの変更を許可します。\n全て許可:「追加と変更」の権限に加え、既存のカスタム絵文字の削除を許可します。\nこの設定にかかわらず、サーバーの管理者およびモデレーターには「全て許可」の権限が与えられます。"
_emojiModPerm:
- none: "不許可"
+ unauthorized: "不許可"
add: "追加"
mod: "追加と変更"
full: "全て許可"
diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml
index 911cbee37..2ecde2760 100644
--- a/locales/zh-TW.yml
+++ b/locales/zh-TW.yml
@@ -2000,7 +2000,7 @@ disableToast: 不顯示「歡迎回來,◯◯」
emojiModPerm: 自訂表情符號的管理
emojiModPermDescription: "新增: 允許新增自訂表情符號,並允許設定尚未設定標籤/類別/授權條款的現有自訂表情符號。\n新增及編輯: 除了「新增」的權限之外,也允許編輯現有自訂表情符號的標籤/類別/授權條款\n全部允許: 除了「新增及編輯」的權限之外,也允許刪除現有的自訂表情符號。\n伺服器管理員及板主無論此設定為何皆有「全部允許」的權限。"
_emojiModPerm:
- none: 不允許
+ unauthorized: 不允許
add: 新增
mod: 新增及編輯
full: 全部允許
diff --git a/packages/backend/migration-neko/1699658378432-emojimod-enum-relabel.js b/packages/backend/migration-neko/1699658378432-emojimod-enum-relabel.js
new file mode 100644
index 000000000..1f681a103
--- /dev/null
+++ b/packages/backend/migration-neko/1699658378432-emojimod-enum-relabel.js
@@ -0,0 +1,15 @@
+export class EmojimodEnumRelabel1699658378432 {
+ name = "EmojimodEnumRelabel1699658378432";
+
+ async up(queryRunner) {
+ await queryRunner.query(
+ `ALTER TYPE "public"."user_emojimodperm_enum" RENAME VALUE 'none' TO 'unauthorized'`,
+ );
+ }
+
+ async down(queryRunner) {
+ await queryRunner.query(
+ `ALTER TYPE "public"."user_emojimodperm_enum" RENAME VALUE 'unauthorized' TO 'none'`,
+ );
+ }
+}
diff --git a/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs b/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs
index 7f38837fd..4dfeff943 100644
--- a/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs
+++ b/packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs
@@ -182,7 +182,7 @@ pub enum UserEmojimodpermEnum {
Mod,
#[default]
#[sea_orm(string_value = "none")]
- None,
+ Unauthorized,
}
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
#[sea_orm(
diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts
index a316f5126..6d7300713 100644
--- a/packages/backend/src/models/entities/user.ts
+++ b/packages/backend/src/models/entities/user.ts
@@ -9,11 +9,11 @@ import {
import { id } from "../id.js";
import { DriveFile } from "./drive-file.js";
-// none: no permission
-// add: add custom emojis to the server
-// mod: add permission + modify {category, tags, license} of existing custom emojis
-// full: mod permission + {rename, delete} existing custom emojis
-export type EmojiModPerm = "none" | "add" | "mod" | "full";
+// unauthorized: no permission
+// add: add custom emojis to the server
+// mod: add permission + modify {category, tags, license} of existing custom emojis
+// full: mod permission + {rename, delete} existing custom emojis
+export type EmojiModPerm = "unauthorized" | "add" | "mod" | "full";
@Entity()
@Index(["usernameLower", "host"], { unique: true })
@@ -187,8 +187,8 @@ export class User {
@Column({
type: "enum",
- enum: ["none", "add", "mod", "full"],
- default: "none",
+ enum: ["unauthorized", "add", "mod", "full"],
+ default: "unauthorized",
})
public emojiModPerm: EmojiModPerm;
diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts
index f30663e7c..a667f775b 100644
--- a/packages/backend/src/models/repositories/user.ts
+++ b/packages/backend/src/models/repositories/user.ts
@@ -450,7 +450,7 @@ export const UserRepository = db.getRepository(User).extend({
avatarUrl: this.getAvatarUrlSync(user),
avatarBlurhash: user.avatar?.blurhash || null,
avatarColor: null, // 後方互換性のため
- emojiModPerm: user.emojiModPerm ?? "none",
+ emojiModPerm: user.emojiModPerm ?? "unauthorized",
isAdmin: user.isAdmin || falsy,
isModerator: user.isModerator || falsy,
isBot: user.isBot || falsy,
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts
index 2633c550b..af4a3ebd9 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts
@@ -41,7 +41,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji mod permission (or add permission if there is no alias)
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const emojis = await Emojis.findBy({
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts
index 7463e84aa..eadc52e30 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts
@@ -38,7 +38,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji add permission
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const file = await DriveFiles.findOneBy({ id: ps.fileId });
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts
index f49f9461f..ef1027dfa 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts
@@ -28,7 +28,9 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => {
// require emoji add permission
- if (!(user.isAdmin || user.isModerator || user.emojiModPerm !== "none"))
+ if (
+ !(user.isAdmin || user.isModerator || user.emojiModPerm !== "unauthorized")
+ )
throw new ApiError(meta.errors.accessDenied);
createImportCustomEmojisJob(user, ps.fileId);
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts
index ab1eb9379..53c234ad2 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts
@@ -104,7 +104,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji add permission
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const q = makePaginationQuery(
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts
index 1c36d78de..759b9eaba 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts
@@ -98,7 +98,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji add permission
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const q = makePaginationQuery(
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts
index f08e143b7..ea7e70f6c 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts
@@ -41,7 +41,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji mod permission (or add permission if there is no alias)
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const emojis = await Emojis.findBy({
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts
index 2831b7d8d..eada64e34 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts
@@ -40,7 +40,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji mod permission (or add permission if there is no category)
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const emojis = await Emojis.findBy({
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts
index af5d02d26..0c498a193 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts
@@ -40,7 +40,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji mod permission (or add permission if there is no license)
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const emojis = await Emojis.findBy({
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts
index 6c5b06e09..039acb39e 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts
@@ -49,7 +49,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, me) => {
// require emoji mod permission (or add permission if there is no category/alias/license)
- if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
+ if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "unauthorized"))
throw new ApiError(meta.errors.accessDenied);
const emoji = await Emojis.findOneBy({ id: ps.id });
diff --git a/packages/backend/src/server/api/endpoints/admin/set-emoji-moderator.ts b/packages/backend/src/server/api/endpoints/admin/set-emoji-moderator.ts
index e963b5c6f..f821a54f0 100644
--- a/packages/backend/src/server/api/endpoints/admin/set-emoji-moderator.ts
+++ b/packages/backend/src/server/api/endpoints/admin/set-emoji-moderator.ts
@@ -25,12 +25,15 @@ export default define(meta, paramDef, async (ps) => {
throw new Error("user not found");
}
- if (!["none", "add", "mod", "full"].includes(ps.emojiModPerm)) {
- throw new Error("emojiModPerm must be 'none', 'add', 'mod', or 'full'");
+ if (!["unauthorized", "add", "mod", "full"].includes(ps.emojiModPerm)) {
+ throw new Error(
+ "emojiModPerm must be 'unauthorized', 'add', 'mod', or 'full'",
+ );
}
const _emojiModPerm =
- (ps.emojiModPerm as "none" | "add" | "mod" | "full") ?? "none";
+ (ps.emojiModPerm as "unauthorized" | "add" | "mod" | "full") ??
+ "unauthorized";
await Users.update(user.id, {
emojiModPerm: _emojiModPerm,
diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts
index 9bfeb1cf4..2f113f75a 100644
--- a/packages/client/src/account.ts
+++ b/packages/client/src/account.ts
@@ -14,7 +14,7 @@ export type Account = firefish.entities.MeDetailed;
export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator);
export const iAmAdmin = $i?.isAdmin;
-export const iAmEmojiMod = iAmModerator || $i?.emojiModPerm !== "none";
+export const iAmEmojiMod = iAmModerator || $i?.emojiModPerm !== "unauthorized";
export async function signout() {
waiting();
diff --git a/packages/client/src/pages/user-info.vue b/packages/client/src/pages/user-info.vue
index 578669262..8929c8094 100644
--- a/packages/client/src/pages/user-info.vue
+++ b/packages/client/src/pages/user-info.vue
@@ -189,8 +189,8 @@
i18n.ts.originalFeature
}}
-