From c18373696783889e000ae7a19bf571fa156aab79 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 16 Oct 2023 16:25:47 +0900 Subject: [PATCH] chore: UserFollowingService.follow() accept withReplies --- packages/backend/src/core/UserFollowingService.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/UserFollowingService.ts b/packages/backend/src/core/UserFollowingService.ts index e9a7d560e4..6ea2f0296b 100644 --- a/packages/backend/src/core/UserFollowingService.ts +++ b/packages/backend/src/core/UserFollowingService.ts @@ -94,9 +94,10 @@ export class UserFollowingService implements OnModuleInit { public async follow( _follower: { id: MiUser['id'] }, _followee: { id: MiUser['id'] }, - { requestId, silent = false }: { + { requestId, silent = false, withReplies }: { requestId?: string, silent?: boolean, + withReplies?: boolean, } = {}, ): Promise { const [follower, followee] = await Promise.all([ @@ -175,12 +176,13 @@ export class UserFollowingService implements OnModuleInit { } if (!autoAccept) { + // TODO: withReplies await this.createFollowRequest(follower, followee, requestId); return; } } - await this.insertFollowingDoc(followee, follower, silent); + await this.insertFollowingDoc(followee, follower, silent, withReplies); if (this.userEntityService.isRemoteUser(follower) && this.userEntityService.isLocalUser(followee)) { const content = this.apRendererService.addContext(this.apRendererService.renderAccept(this.apRendererService.renderFollow(follower, followee, requestId), followee)); @@ -194,9 +196,10 @@ export class UserFollowingService implements OnModuleInit { id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'] }, follower: { - id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'], defaultWithReplies: MiUser['defaultWithReplies']; + id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'] }, silent = false, + withReplies?: boolean, ): Promise { if (follower.id === followee.id) return; @@ -206,7 +209,7 @@ export class UserFollowingService implements OnModuleInit { id: this.idService.gen(), followerId: follower.id, followeeId: followee.id, - withReplies: follower.defaultWithReplies, + withReplies: withReplies, // 非正規化 followerHost: follower.host,