From 46864916d912e4e6e6b8a23a668505e3ad5bc52f Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 12 Apr 2023 15:52:46 +0900 Subject: [PATCH 1/2] Allow to mute my own boosts --- .../src/server/api/endpoints/renote-mute/create.ts | 11 ----------- .../src/server/api/endpoints/renote-mute/delete.ts | 11 ----------- packages/client/src/scripts/get-user-menu.ts | 10 +++++----- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/renote-mute/create.ts b/packages/backend/src/server/api/endpoints/renote-mute/create.ts index 82db79cc6a..857cbd9756 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/create.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/create.ts @@ -19,12 +19,6 @@ export const meta = { id: "6fef56f3-e765-4957-88e5-c6f65329b8a5", }, - muteeIsYourself: { - message: "Mutee is yourself.", - code: "MUTEE_IS_YOURSELF", - id: "a4619cb2-5f23-484b-9301-94c903074e10", - }, - alreadyMuting: { message: "You are already muting that user.", code: "ALREADY_MUTING", @@ -45,11 +39,6 @@ export const paramDef = { export default define(meta, paramDef, async (ps, user) => { const muter = user; - // 自分自身 - if (user.id === ps.userId) { - throw new ApiError(meta.errors.muteeIsYourself); - } - // Get mutee const mutee = await getUser(ps.userId).catch((e) => { if (e.id === "15348ddd-432d-49c2-8a5a-8069753becff") diff --git a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts index 4fd500d7cc..fb4c972af0 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts @@ -17,12 +17,6 @@ export const meta = { id: "b851d00b-8ab1-4a56-8b1b-e24187cb48ef", }, - muteeIsYourself: { - message: "Mutee is yourself.", - code: "MUTEE_IS_YOURSELF", - id: "f428b029-6b39-4d48-a1d2-cc1ae6dd5cf9", - }, - notMuting: { message: "You are not muting that user.", code: "NOT_MUTING", @@ -43,11 +37,6 @@ export const paramDef = { export default define(meta, paramDef, async (ps, user) => { const muter = user; - // Check if the mutee is yourself - if (user.id === ps.userId) { - throw new ApiError(meta.errors.muteeIsYourself); - } - // Get mutee const mutee = await getUser(ps.userId).catch((e) => { if (e.id === "15348ddd-432d-49c2-8a5a-8069753becff") diff --git a/packages/client/src/scripts/get-user-menu.ts b/packages/client/src/scripts/get-user-menu.ts index fd1ce08209..d55c3374f1 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -267,11 +267,6 @@ export function getUserMenu(user, router: Router = mainRouter) { action: inviteGroup, } : undefined, - ] as any; - - if ($i && meId !== user.id) { - menu = menu.concat([ - null, { icon: user.isRenoteMuted ? "ph-eye ph-bold ph-lg" @@ -279,6 +274,11 @@ export function getUserMenu(user, router: Router = mainRouter) { text: user.isRenoteMuted ? i18n.ts.renoteUnmute : i18n.ts.renoteMute, action: toggleRenoteMute, }, + ] as any; + + if ($i && meId !== user.id) { + menu = menu.concat([ + null, { icon: user.isMuted ? "ph-eye ph-bold ph-lg" From e8566b95aa24b452c8987e12707a4a38ad5847f9 Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 12 Apr 2023 20:24:54 +0900 Subject: [PATCH 2/2] correct position --- packages/client/src/scripts/get-user-menu.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/client/src/scripts/get-user-menu.ts b/packages/client/src/scripts/get-user-menu.ts index d55c3374f1..2ea72c9983 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -267,18 +267,18 @@ export function getUserMenu(user, router: Router = mainRouter) { action: inviteGroup, } : undefined, - { - icon: user.isRenoteMuted - ? "ph-eye ph-bold ph-lg" - : "ph-eye-slash ph-bold ph-lg", - text: user.isRenoteMuted ? i18n.ts.renoteUnmute : i18n.ts.renoteMute, - action: toggleRenoteMute, - }, + null, + { + icon: user.isRenoteMuted + ? "ph-eye ph-bold ph-lg" + : "ph-eye-slash ph-bold ph-lg", + text: user.isRenoteMuted ? i18n.ts.renoteUnmute : i18n.ts.renoteMute, + action: toggleRenoteMute, + }, ] as any; if ($i && meId !== user.id) { menu = menu.concat([ - null, { icon: user.isMuted ? "ph-eye ph-bold ph-lg"