From b4420f895eda5c3661df273c5059a5923793432d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Sat, 30 Mar 2024 15:55:36 +0900 Subject: [PATCH] =?UTF-8?q?enhance(moderation):=20=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=80=85=E3=81=8C=E3=82=A2=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E7=89=A9=E7=90=86=E5=89=8A=E9=99=A4=E3=83=BB=E8=AB=96?= =?UTF-8?q?=E7=90=86=E5=89=8A=E9=99=A4=E3=82=92=E9=81=B8=E3=81=B9=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=20(MisskeyIO#581)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/endpoints/admin/accounts/delete.ts | 4 +-- packages/frontend/src/pages/admin-user.vue | 31 ++++++++++++------- packages/misskey-js/src/autogen/types.ts | 5 +++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index ed7a1424dd..ef66e54e2c 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -37,6 +37,7 @@ export const paramDef = { type: 'object', properties: { userId: { type: 'string', format: 'misskey:id' }, + soft: { type: 'boolean', default: true, description: 'Since deletion by an administrator is a moderation action, the default is to soft delete.' }, }, required: ['userId'], } as const; @@ -56,8 +57,7 @@ export default class extends Endpoint { // eslint- if (user == null) throw new ApiError(meta.errors.userNotFound); if (await this.roleService.isModerator(user)) throw new ApiError(meta.errors.cannotDeleteModerator); - // 管理者からの削除ということはモデレーション行為なので、soft delete にする - await this.deleteAccountService.deleteAccount(user, true, me); + await this.deleteAccountService.deleteAccount(user, ps.soft, me); }); } } diff --git a/packages/frontend/src/pages/admin-user.vue b/packages/frontend/src/pages/admin-user.vue index 59dc0ba0ec..294807ed3d 100644 --- a/packages/frontend/src/pages/admin-user.vue +++ b/packages/frontend/src/pages/admin-user.vue @@ -58,11 +58,16 @@ SPDX-License-Identifier: AGPL-3.0-only
- {{ i18n.ts.suspend }} - -
- {{ i18n.ts.resetPassword }} -
+ + + +
+ {{ i18n.ts.suspend }} + {{ i18n.ts.resetPassword }} + {{ i18n.ts.unsetUserAvatar }} + {{ i18n.ts.unsetUserBanner }} +
+
@@ -87,11 +92,14 @@ SPDX-License-Identifier: AGPL-3.0-only -
- {{ i18n.ts.unsetUserAvatar }} - {{ i18n.ts.unsetUserBanner }} -
- {{ i18n.ts.deleteAccount }} + + + +
+ {{ i18n.ts.deleteAccount }} + {{ i18n.ts.deleteAccount }} ({{ i18n.ts.all }}) +
+
@@ -380,7 +388,7 @@ async function deleteAllFiles() { } } -async function deleteAccount() { +async function deleteAccount(soft: boolean) { const confirm = await os.confirm({ type: 'warning', text: i18n.ts.deleteAccountConfirm, @@ -395,6 +403,7 @@ async function deleteAccount() { if (typed.result === user.value?.username) { await os.apiWithDialog('admin/accounts/delete', { userId: user.value.id, + soft, }).then(refreshUser); } else { os.alert({ diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 398da6bbe9..f4e5047116 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -5438,6 +5438,11 @@ export type operations = { 'application/json': { /** Format: misskey:id */ userId: string; + /** + * @description Since deletion by an administrator is a moderation action, the default is to soft delete. + * @default true + */ + soft?: boolean; }; }; };