diff --git a/package.json b/package.json index 7238c8621..212136cda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "13.0.0-rc4", + "version": "13.0.0-rc5", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index 562d35007..08d7368cd 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -2,6 +2,7 @@ import type { User } from '@/models/entities/user.js'; import { resolveUser } from '@/remote/resolve-user.js'; import { DAY } from '@/const.js'; import DeliverManager from '@/remote/activitypub/deliver-manager.js'; +import { deliver } from '@/queue/index.js'; import { renderActivity } from '@/remote/activitypub/renderer/index.js'; import type { IActivity } from '@/remote/activitypub/type.js'; import define from '../../define.js'; @@ -51,10 +52,23 @@ export const paramDef = { required: ['moveToAccount'], } as const; +function moveActivity(to: User, from: User) { + const activity = { + id: 'foo', + actor: from, + type: 'Move', + object: from, + target: to, + } as any; + + const content = renderActivity(activity); + deliver(to, content, from.inbox); +} + // eslint-disable-next-line import/no-default-export export default define(meta, paramDef, async (ps, user) => { if (!ps.moveToAccount) throw new ApiError(meta.errors.noSuchMoveTarget); - if(user.isAdmin) throw new ApiError(meta.errors.adminForbidden); + if (user.isAdmin) throw new ApiError(meta.errors.adminForbidden); let unfiltered: string = ps.moveToAccount; @@ -75,23 +89,10 @@ export default define(meta, paramDef, async (ps, user) => { if (!allowed || !moveTo.uri || !user.uri) throw new ApiError(meta.errors.remoteAccountForbids); - (async (): Promise => { - const moveAct = await moveActivity(moveTo.uri!, user.uri!); - const dm = new DeliverManager(user, moveAct); - dm.addFollowersRecipe(); - dm.execute(); - })(); + const moveAct = moveActivity(moveTo, user); + const dm = new DeliverManager(user, moveAct); + dm.addFollowersRecipe(); + dm.execute(); + return true; }); - -async function moveActivity(to: string, from: string): Promise { - const activity = { - id: 'foo', - actor: from, - type: 'Move', - object: from, - target: to, - } as any; - - return renderActivity(activity); -} diff --git a/packages/client/src/pages/settings/migration.vue b/packages/client/src/pages/settings/migration.vue index 80430a144..80285b232 100644 --- a/packages/client/src/pages/settings/migration.vue +++ b/packages/client/src/pages/settings/migration.vue @@ -49,7 +49,7 @@ async function move(account): Promise { text: i18n.t('migrationConfirm', { account: account.toString() }), }); if (confirm.canceled) return; - os.api('i/move', { + os.apiWithDialog('i/move', { moveToAccount: account, }); }