From 1448533957c5fbf9a4a41ea54cb3eb2a9fbd3df3 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sun, 6 Jul 2025 20:03:46 -0400 Subject: [PATCH] add context menu to set user CW --- .../frontend/src/utility/get-user-menu.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/frontend/src/utility/get-user-menu.ts b/packages/frontend/src/utility/get-user-menu.ts index fde390cece..f65660ff6c 100644 --- a/packages/frontend/src/utility/get-user-menu.ts +++ b/packages/frontend/src/utility/get-user-menu.ts @@ -102,6 +102,22 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router }); } + async function setMandatoryCW() { + const result = await os.inputText({ + type: 'text', + title: i18n.ts.mandatoryCW, + text: i18n.ts.mandatoryCWDescription, + default: user.mandatoryCW ?? '', + }); + + if (result.canceled) return; + + await os.apiWithDialog('admin/cw-user', { + userId: user.id, + cw: result.result || null, + }); + } + async function getConfirmed(text: string): Promise { const confirm = await os.confirm({ type: 'question', @@ -399,6 +415,14 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router text: i18n.ts.reportAbuse, action: reportAbuse, }); + + if ($i.isModerator) { + menuItems.push({ + icon: 'ph-warning ph-bold ph-lg', + text: i18n.ts.mandatoryCW, + action: setMandatoryCW, + }); + } } if (user.host !== null) {