feat: truncate account
from bscone fork
This commit is contained in:
parent
219ddedae3
commit
13e4702c07
20 changed files with 454 additions and 25 deletions
|
@ -67,13 +67,24 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #label>{{ i18n.ts.closeAccount }}</template>
|
||||
|
||||
<div v-if="$i.policies.canUseAccountRemoval" class="_gaps_m">
|
||||
<FormInfo warn>{{ i18n.ts._accountDelete.mayTakeTime }}</FormInfo>
|
||||
<FormInfo>{{ i18n.ts._accountDelete.sendEmail }}</FormInfo>
|
||||
<MkInfo warn>{{ i18n.ts._accountDelete.mayTakeTime }}</MkInfo>
|
||||
<MkInfo>{{ i18n.ts._accountDelete.sendEmail }}</MkInfo>
|
||||
<MkButton v-if="!$i.isDeleted" danger @click="deleteAccount">{{ i18n.ts._accountDelete.requestAccountDelete }}</MkButton>
|
||||
<MkButton v-else disabled>{{ i18n.ts._accountDelete.inProgress }}</MkButton>
|
||||
</div>
|
||||
<div v-else class="_gaps_m">
|
||||
<FormInfo warn>{{ i18n.ts._accountDelete.youCantUseThisTime }}</FormInfo>
|
||||
<MkInfo warn>{{ i18n.ts._accountDelete.youCantUseThisTime }}</MkInfo>
|
||||
</div>
|
||||
</MkFolder>
|
||||
|
||||
<MkFolder>
|
||||
<template #icon><i class="ti ti-recycle"></i></template>
|
||||
<template #label>{{ i18n.ts.truncateAccount }}</template>
|
||||
|
||||
<div class="_gaps_m">
|
||||
<MkInfo warn>{{ i18n.ts._accountTruncate.mayTakeTime }}</MkInfo>
|
||||
<MkButton v-if="!$i.isDeleted" danger @click="truncateAccount">{{ i18n.ts._accountTruncate.requestAccountTruncate }}</MkButton>
|
||||
<MkButton v-else disabled>{{ i18n.ts._accountTruncate.inProgress }}</MkButton>
|
||||
</div>
|
||||
</MkFolder>
|
||||
|
||||
|
@ -105,11 +116,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import FormLink from '@/components/form/link.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import FormInfo from '@/components/MkInfo.vue';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkKeyValue from '@/components/MkKeyValue.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import * as os from '@/os.js';
|
||||
|
@ -118,15 +131,24 @@ import { defaultStore } from '@/store.js';
|
|||
import { signout, signinRequired } from '@/account.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import { unisonReload } from '@/scripts/unison-reload.js';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import MkInput from "@/components/MkInput.vue";
|
||||
|
||||
const $i = signinRequired();
|
||||
|
||||
// const reportError = computed(defaultStore.makeGetterSetter('reportError'));
|
||||
const devMode = computed(defaultStore.makeGetterSetter('devMode'));
|
||||
const defaultWithReplies = computed(defaultStore.makeGetterSetter('defaultWithReplies'));
|
||||
const autoRemoval = ref<boolean>($i.autoRemovalCondition.active);
|
||||
const deleteAfter = ref<number>($i.autoRemovalCondition.deleteAfter || 7);
|
||||
const noPiningNotes = ref<boolean>($i.autoRemovalCondition.noPiningNotes);
|
||||
const noSpecifiedNotes = ref<boolean>($i.autoRemovalCondition.noSpecifiedNotes);
|
||||
|
||||
function saveRemovalCondition() {
|
||||
misskeyApi('i/update-removal-condition', {
|
||||
active: autoRemoval.value,
|
||||
deleteAfter: deleteAfter.value,
|
||||
noPiningNotes: noPiningNotes.value,
|
||||
noSpecifiedNotes: noSpecifiedNotes.value,
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteAccount() {
|
||||
{
|
||||
|
@ -152,6 +174,28 @@ async function deleteAccount() {
|
|||
await signout();
|
||||
}
|
||||
|
||||
async function truncateAccount() {
|
||||
{
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.truncateAccountConfirm,
|
||||
});
|
||||
if (canceled) return;
|
||||
}
|
||||
|
||||
const auth = await os.authenticateDialog();
|
||||
if (auth.canceled) return;
|
||||
|
||||
await os.apiWithDialog('i/truncate-account', {
|
||||
password: auth.result.password,
|
||||
token: auth.result.token,
|
||||
});
|
||||
|
||||
await os.alert({
|
||||
title: i18n.ts._accountTruncate.started,
|
||||
});
|
||||
}
|
||||
|
||||
async function updateRepliesAll(withReplies: boolean) {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
|
|
|
@ -76,8 +76,6 @@ import MkSwitch from '@/components/MkSwitch.vue';
|
|||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
@ -95,10 +93,6 @@ const hideOnlineStatus = ref($i.hideOnlineStatus);
|
|||
const publicReactions = ref($i.publicReactions);
|
||||
const followingVisibility = ref($i.followingVisibility);
|
||||
const followersVisibility = ref($i.followersVisibility);
|
||||
const autoRemoval = ref<boolean>($i.autoRemovalCondition.active);
|
||||
const deleteAfter = ref<number>($i.autoRemovalCondition.deleteAfter || 7);
|
||||
const noPiningNotes = ref<boolean>($i.autoRemovalCondition.noPiningNotes);
|
||||
const noSpecifiedNotes = ref<boolean>($i.autoRemovalCondition.noSpecifiedNotes);
|
||||
|
||||
const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNoteVisibility'));
|
||||
const defaultNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly'));
|
||||
|
@ -119,15 +113,6 @@ function save() {
|
|||
});
|
||||
}
|
||||
|
||||
function saveRemovalCondition() {
|
||||
misskeyApi('i/update-removal-condition', {
|
||||
active: autoRemoval.value,
|
||||
deleteAfter: deleteAfter.value,
|
||||
noPiningNotes: noPiningNotes.value,
|
||||
noSpecifiedNotes: noSpecifiedNotes.value,
|
||||
});
|
||||
}
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
||||
const headerTabs = computed(() => []);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue