diff --git a/packages/backend/src/server/api/endpoints/i/known-as.ts b/packages/backend/src/server/api/endpoints/i/known-as.ts index d4d9061b30..0d0c06180a 100644 --- a/packages/backend/src/server/api/endpoints/i/known-as.ts +++ b/packages/backend/src/server/api/endpoints/i/known-as.ts @@ -38,14 +38,14 @@ export const meta = { id: "bf326f31-d430-4f97-9933-5d61e4d48a23", }, alreadyMoved: { - message: 'You have already moved your account.', - code: 'ALREADY_MOVED', - id: '56f20ec9-fd06-4fa5-841b-edd6d7d4fa31', + message: "You have already moved your account.", + code: "ALREADY_MOVED", + id: "56f20ec9-fd06-4fa5-841b-edd6d7d4fa31", }, yourself: { - message: 'You can\'t set yourself as your own alias.', - code: 'FORBIDDEN_TO_SET_YOURSELF', - id: '25c90186-4ab0-49c8-9bba-a1fa6c202ba4', + message: "You can't set yourself as your own alias.", + code: "FORBIDDEN_TO_SET_YOURSELF", + id: "25c90186-4ab0-49c8-9bba-a1fa6c202ba4", }, }, } as const; @@ -54,10 +54,10 @@ export const paramDef = { type: "object", properties: { alsoKnownAs: { - type: 'array', + type: "array", maxItems: 10, uniqueItems: true, - items: { type: 'string' }, + items: { type: "string" }, }, }, required: ["alsoKnownAs"], diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index ba2360b196..d972aaf1d9 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -98,12 +98,10 @@ export default define(meta, paramDef, async (ps, user) => { const { username, host } = parse(ps.moveToAccount); if (!host) throw new ApiError(meta.errors.notRemote); - const moveTo: User = await resolveUser(username, host).catch( - (e) => { - apiLogger.warn(`failed to resolve remote user: ${e}`); - throw new ApiError(meta.errors.noSuchMoveTarget); - }, - ); + const moveTo: User = await resolveUser(username, host).catch((e) => { + apiLogger.warn(`failed to resolve remote user: ${e}`); + throw new ApiError(meta.errors.noSuchMoveTarget); + }); let fromUrl: string | null = user.uri; if (!fromUrl) { fromUrl = `${config.url}/users/${user.id}`; diff --git a/packages/client/src/pages/settings/migration.vue b/packages/client/src/pages/settings/migration.vue index 610d1ce1fe..df65e6e25c 100644 --- a/packages/client/src/pages/settings/migration.vue +++ b/packages/client/src/pages/settings/migration.vue @@ -2,9 +2,13 @@
- {{ i18n.ts.moveAccountDescription }} + {{ + i18n.ts.moveAccountDescription + }} - + @@ -14,14 +18,30 @@ - {{ i18n.ts.moveFromDescription }} - - - + {{ + i18n.ts.moveFromDescription + }} + + + - - {{ i18n.ts.add }} + + {{ i18n.ts.add }} {{ i18n.ts.save }} @@ -39,7 +59,7 @@ import * as os from "@/os"; import { i18n } from "@/i18n"; import { definePageMetadata } from "@/scripts/page-metadata"; import { $i } from "@/account"; -import { toString } from 'calckey-js/built/acct'; +import { toString } from "calckey-js/built/acct"; let moveToAccount = $ref(""); let accountAlias = $ref([""]); @@ -48,21 +68,26 @@ await init(); async function init() { if ($i?.alsoKnownAs && $i.alsoKnownAs.length > 0) { - const aka = await os.api('users/show', { userIds: $i.alsoKnownAs }); - accountAlias = (aka && aka.length > 0) ? aka.map(user => `@${toString(user)}`) : ['']; + const aka = await os.api("users/show", { userIds: $i.alsoKnownAs }); + accountAlias = + aka && aka.length > 0 + ? aka.map((user) => `@${toString(user)}`) + : [""]; + } else { + accountAlias = [""]; } } async function save(): Promise { - const i = os.apiWithDialog("i/known-as", { - alsoKnownAs: accountAlias.map(e => e.trim()).filter(e => e !== ""), + const i = await os.apiWithDialog("i/known-as", { + alsoKnownAs: accountAlias.map((e) => e.trim()).filter((e) => e !== ""), }); $i.alsoKnownAs = i.alsoKnownAs; await init(); } function add(): void { - accountAlias.push(''); + accountAlias.push(""); } async function move(account): Promise {