diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-06-27 23:49:16 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-06-27 23:49:16 +0900 |
| commit | 329f055a976dc3b2e12f2a0141bfab2c57ae9193 (patch) | |
| tree | 0f11f906c0e0401b83604e91bfee33ff6214e254 /packages/client/src | |
| parent | refactor: remove duplicate code (#8895) (diff) | |
| download | misskey-329f055a976dc3b2e12f2a0141bfab2c57ae9193.tar.gz misskey-329f055a976dc3b2e12f2a0141bfab2c57ae9193.tar.bz2 misskey-329f055a976dc3b2e12f2a0141bfab2c57ae9193.zip | |
feat: make possible to delete an account by admin
Resolve #8830
Diffstat (limited to 'packages/client/src')
| -rw-r--r-- | packages/client/src/pages/user-info.vue | 29 |
1 files changed, 28 insertions, 1 deletions
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 @@ <FormSwitch v-model="silenced" class="_formBlock" @update:modelValue="toggleSilence">{{ $ts.silence }}</FormSwitch> <FormSwitch v-model="suspended" class="_formBlock" @update:modelValue="toggleSuspend">{{ $ts.suspend }}</FormSwitch> {{ $ts.reflectMayTakeTime }} - <FormButton v-if="user.host == null && iAmModerator" class="_formBlock" @click="resetPassword"><i class="fas fa-key"></i> {{ $ts.resetPassword }}</FormButton> + <div class="_formBlock"> + <FormButton v-if="user.host == null && iAmModerator" inline style="margin-right: 8px;" @click="resetPassword"><i class="fas fa-key"></i> {{ $ts.resetPassword }}</FormButton> + <FormButton v-if="$i.isAdmin" inline danger @click="deleteAccount">{{ $ts.deleteAccount }}</FormButton> + </div> </FormSection> <FormSection> @@ -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(); }, { |