From 329f055a976dc3b2e12f2a0141bfab2c57ae9193 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 27 Jun 2022 23:49:16 +0900 Subject: feat: make possible to delete an account by admin Resolve #8830 --- packages/client/src/pages/user-info.vue | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'packages/client/src') diff --git a/packages/client/src/pages/user-info.vue b/packages/client/src/pages/user-info.vue index 86c1be8d06..9dfb2d87a0 100644 --- a/packages/client/src/pages/user-info.vue +++ b/packages/client/src/pages/user-info.vue @@ -35,7 +35,10 @@ {{ $ts.silence }} {{ $ts.suspend }} {{ $ts.reflectMayTakeTime }} - {{ $ts.resetPassword }} +
+ {{ $ts.resetPassword }} + {{ $ts.deleteAccount }} +
@@ -233,6 +236,30 @@ async function deleteAllFiles() { await refreshUser(); } +async function deleteAccount() { + const confirm = await os.confirm({ + type: 'warning', + text: i18n.ts.deleteAccountConfirm, + }); + if (confirm.canceled) return; + + const typed = await os.inputText({ + text: i18n.t('typeToConfirm', { x: user?.username }), + }); + if (typed.canceled) return; + + if (typed.result === user?.username) { + await os.apiWithDialog('admin/delete-account', { + userId: user.id, + }); + } else { + os.alert({ + type: 'error', + text: 'input not match', + }); + } +} + watch(() => props.userId, () => { init = createFetcher(); }, { -- cgit v1.2.3-freya