From df1359e3926fbdaf4feb36ff9eed0a2bd7e2f141 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 4 Dec 2022 12:46:10 -0800 Subject: [PATCH] fix imports --- .../src/remote/activitypub/kernel/index.ts | 12 +++---- .../remote/activitypub/kernel/move/index.ts | 36 ++++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/packages/backend/src/remote/activitypub/kernel/index.ts b/packages/backend/src/remote/activitypub/kernel/index.ts index be617942df..b8af3dc487 100644 --- a/packages/backend/src/remote/activitypub/kernel/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/index.ts @@ -1,5 +1,6 @@ +import type { CacheableRemoteUser } from '@/models/entities/user.js'; +import { toArray } from '@/prelude/array.js'; import { - IObject, isCreate, isDelete, isUpdate, @@ -16,9 +17,10 @@ import { isCollectionOrOrderedCollection, isCollection, isFlag, - isMove + isMove, } from '../type.js'; -import { CacheableRemoteUser } from '@/models/entities/user.js'; +import { apLogger } from '../logger.js'; +import Resolver from '../resolver.js'; import create from './create/index.js'; import performDeleteActivity from './delete/index.js'; import performUpdateActivity from './update/index.js'; @@ -33,10 +35,8 @@ import add from './add/index.js'; import remove from './remove/index.js'; import block from './block/index.js'; import flag from './flag/index.js'; -import { apLogger } from '../logger.js'; -import Resolver from '../resolver.js'; -import { toArray } from '@/prelude/array.js'; import move from './move/index.js'; +import type { IObject } from '../type.js'; export async function performActivity(actor: CacheableRemoteUser, activity: IObject) { if (isCollectionOrOrderedCollection(activity)) { diff --git a/packages/backend/src/remote/activitypub/kernel/move/index.ts b/packages/backend/src/remote/activitypub/kernel/move/index.ts index 71d7165057..d142ee8c9f 100644 --- a/packages/backend/src/remote/activitypub/kernel/move/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/move/index.ts @@ -1,15 +1,17 @@ -import {CacheableRemoteUser, IRemoteUser, User} from '@/models/entities/user.js'; -import {IMove, IObject, IActor} from '../../type.js'; -import DbResolver from "@/remote/activitypub/db-resolver"; -import {getRemoteUser} from '@/server/api/common/getters.js'; +import type { CacheableRemoteUser } from '@/models/entities/user.js'; +import { IRemoteUser, User } from '@/models/entities/user.js'; +import DbResolver from '@/remote/activitypub/db-resolver'; +import { getRemoteUser } from '@/server/api/common/getters.js'; import { updatePerson } from '@/remote/activitypub/models/person.js'; -import {Followings, Users} from "@/models"; -import {makePaginationQuery} from "@/server/api/common/make-pagination-query"; +import { Followings, Users } from '@/models'; +import { makePaginationQuery } from '@/server/api/common/make-pagination-query'; import deleteFollowing from '@/services/following/delete.js'; import create from '@/services/following/create.js'; -import {IdentifiableError} from "@/misc/identifiable-error"; -import {ApiError} from "@/server/api/error"; -import {meta} from "@/server/api/endpoints/following/create"; +import { IdentifiableError } from '@/misc/identifiable-error'; +import { ApiError } from '@/server/api/error'; +import { meta } from '@/server/api/endpoints/following/create'; +import { IObject, IActor } from '../../type.js'; +import type { IMove } from '../../type.js'; export default async (actor: CacheableRemoteUser, activity: IMove): Promise => { // ※ There is a block target in activity.object, which should be a local user that exists. @@ -22,19 +24,19 @@ export default async (actor: CacheableRemoteUser, activity: IMove): Promiseactivity.actor); if (!new_acc || new_acc.uri === null) { - return `move: new acc not found`; + return 'move: new acc not found'; } if (!old_acc || old_acc.uri === null) { - return `move: old acc not found`; + return 'move: old acc not found'; } await updatePerson(new_acc.uri); await updatePerson(old_acc.uri); new_acc = await getRemoteUser(new_acc.uri); old_acc = await getRemoteUser(old_acc.uri); - if(old_acc === null || old_acc.uri === null || !new_acc?.alsoKnownAs?.includes(old_acc.uri)) return `move: accounts invalid`; + if (old_acc === null || old_acc.uri === null || !new_acc.alsoKnownAs?.includes(old_acc.uri)) return 'move: accounts invalid'; - old_acc.movedToUri = new_acc?.uri + old_acc.movedToUri = new_acc.uri; const query = makePaginationQuery(Followings.createQueryBuilder('following')) .andWhere('following.followeeId = :userId', { userId: old_acc.id }) @@ -44,8 +46,8 @@ export default async (actor: CacheableRemoteUser, activity: IMove): Promise { - if(!following.follower?.host) { - let follower = following.follower; + if (!following.follower?.host) { + const follower = following.follower; deleteFollowing(follower!, old_acc!); try { create(follower!, new_acc!); @@ -57,7 +59,7 @@ export default async (actor: CacheableRemoteUser, activity: IMove): Promise