feat: account migration (#10507)
* add Move activity * add endpoint to move from local to remote * follow move activity coming to inbox * fix move endpoint * add known-as endpoint to create account alias * add migration page * add route to migration page * add move and known-as endpoints * fix dependnecies error * fix new endpoints * fix move activity id * fix refollow * add movedToUri and alsoKnownAs to api * fix moveToUri indicator * fix missing context * add chengelog * rename MkMoved to MkAccountMoved * add missing semicolon * fix targetUri * fix followings query * remove redundant null check
This commit is contained in:
33
packages/frontend/src/components/MkAccountMoved.vue
Normal file
33
packages/frontend/src/components/MkAccountMoved.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="msjugskd _block">
|
||||
<i class="ti ti-plane-departure" style="margin-right: 8px;"></i>
|
||||
{{ i18n.ts.accountMoved }}
|
||||
<MkMention class="link" :username="acct" :host="host ?? localHost"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MkMention from './MkMention.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
import { host as localHost } from '@/config';
|
||||
|
||||
defineProps<{
|
||||
acct: string;
|
||||
host: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.msjugskd {
|
||||
padding: 16px;
|
||||
font-size: 90%;
|
||||
background: var(--infoWarnBg);
|
||||
color: var(--error);
|
||||
border-radius: var(--radius);
|
||||
|
||||
> .link {
|
||||
margin-left: 4px;
|
||||
color: var(--accent);
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -130,6 +130,11 @@ const menuDef = computed(() => [{
|
||||
}, {
|
||||
title: i18n.ts.otherSettings,
|
||||
items: [{
|
||||
icon: 'ti ti-plane',
|
||||
text: i18n.ts.migration,
|
||||
to: '/settings/migration',
|
||||
active: currentPage?.route.name === 'migration',
|
||||
}, {
|
||||
icon: 'ti ti-package',
|
||||
text: i18n.ts.importAndExport,
|
||||
to: '/settings/import-export',
|
||||
|
73
packages/frontend/src/pages/settings/migration.vue
Normal file
73
packages/frontend/src/pages/settings/migration.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div class="_gaps_m">
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts.moveTo }}</template>
|
||||
<MkInput v-model="moveToAccount" manual-save>
|
||||
<template #prefix><i class="ti ti-plane-departure"></i></template>
|
||||
<template #label>{{ i18n.ts.moveToLabel }}</template>
|
||||
</MkInput>
|
||||
</FormSection>
|
||||
<FormInfo warn>{{ i18n.ts.moveAccountDescription }}</FormInfo>
|
||||
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts.moveFrom }}</template>
|
||||
<MkInput v-model="accountAlias" manual-save>
|
||||
<template #prefix><i class="ti ti-plane-arrival"></i></template>
|
||||
<template #label>{{ i18n.ts.moveFromLabel }}</template>
|
||||
</MkInput>
|
||||
</FormSection>
|
||||
<FormInfo warn>{{ i18n.ts.moveFromDescription }}</FormInfo>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import FormInfo from '@/components/MkInfo.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
|
||||
const moveToAccount = ref('');
|
||||
const accountAlias = ref('');
|
||||
|
||||
async function move(): Promise<void> {
|
||||
const account = moveToAccount.value;
|
||||
const confirm = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.t('migrationConfirm', { account: account.toString() }),
|
||||
});
|
||||
if (confirm.canceled) return;
|
||||
os.apiWithDialog('i/move', {
|
||||
moveToAccount: account,
|
||||
});
|
||||
}
|
||||
|
||||
async function save(): Promise<void> {
|
||||
const account = accountAlias.value;
|
||||
os.apiWithDialog('i/known-as', {
|
||||
alsoKnownAs: account,
|
||||
});
|
||||
}
|
||||
|
||||
watch(accountAlias, async () => {
|
||||
await save();
|
||||
});
|
||||
|
||||
watch(moveToAccount, async () => {
|
||||
await move();
|
||||
});
|
||||
|
||||
definePageMetadata({
|
||||
title: i18n.ts.migration,
|
||||
icon: 'ti ti-plane',
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.description {
|
||||
font-size: .85em;
|
||||
padding: 1rem;
|
||||
}
|
||||
</style>
|
@@ -7,6 +7,7 @@
|
||||
<!-- <div class="punished" v-if="user.isSilenced"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i> {{ i18n.ts.userSilenced }}</div> -->
|
||||
|
||||
<div class="profile _gaps">
|
||||
<MkAccountMoved v-if="user.movedToUri" :host="user.movedToUri.host" :acct="user.movedToUri.username"/>
|
||||
<MkRemoteCaution v-if="user.host != null" :href="user.url ?? user.uri!" class="warn"/>
|
||||
|
||||
<div :key="user.id" class="main _panel">
|
||||
@@ -117,6 +118,7 @@ import calcAge from 's-age';
|
||||
import * as misskey from 'misskey-js';
|
||||
import MkNote from '@/components/MkNote.vue';
|
||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||
import MkAccountMoved from '@/components/MkAccountMoved.vue';
|
||||
import MkRemoteCaution from '@/components/MkRemoteCaution.vue';
|
||||
import MkOmit from '@/components/MkOmit.vue';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
|
@@ -161,6 +161,10 @@ export const routes = [{
|
||||
path: '/preferences-backups',
|
||||
name: 'preferences-backups',
|
||||
component: page(() => import('./pages/settings/preferences-backups.vue')),
|
||||
}, {
|
||||
path: '/migration',
|
||||
name: 'migration',
|
||||
component: page(() => import('./pages/settings/migration.vue'))
|
||||
}, {
|
||||
path: '/custom-css',
|
||||
name: 'general',
|
||||
|
Reference in New Issue
Block a user