From 4151087d3cd83da8dcb0f82d4269d0f719698e0f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 14 Jan 2023 08:27:23 +0900 Subject: フォロワー数、フォロー数もConditional roleで利用できるように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/UserFollowingService.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'packages/backend/src/core/UserFollowingService.ts') diff --git a/packages/backend/src/core/UserFollowingService.ts b/packages/backend/src/core/UserFollowingService.ts index 52834c375e..f1ce311cea 100644 --- a/packages/backend/src/core/UserFollowingService.ts +++ b/packages/backend/src/core/UserFollowingService.ts @@ -62,6 +62,7 @@ export class UserFollowingService { private federatedInstanceService: FederatedInstanceService, private webhookService: WebhookService, private apRendererService: ApRendererService, + private globalEventService: GlobalEventService, private perUserFollowingChart: PerUserFollowingChart, private instanceChart: InstanceChart, ) { @@ -195,6 +196,8 @@ export class UserFollowingService { } if (alreadyFollowed) return; + + this.globalEventService.publishInternalEvent('follow', { followerId: follower.id, followeeId: followee.id }); //#region Increment counts await Promise.all([ @@ -314,6 +317,8 @@ export class UserFollowingService { follower: {id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }, ): Promise { + this.globalEventService.publishInternalEvent('unfollow', { followerId: follower.id, followeeId: followee.id }); + //#region Decrement following / followers counts await Promise.all([ this.usersRepository.decrement({ id: follower.id }, 'followingCount', 1), -- cgit v1.2.3-freya