summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/UserFollowingService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-01-14 08:27:23 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-01-14 08:27:23 +0900
commit4151087d3cd83da8dcb0f82d4269d0f719698e0f (patch)
tree92bec585e755d16c822469883dea3de77104db28 /packages/backend/src/core/UserFollowingService.ts
parentMerge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff)
downloadsharkey-4151087d3cd83da8dcb0f82d4269d0f719698e0f.tar.gz
sharkey-4151087d3cd83da8dcb0f82d4269d0f719698e0f.tar.bz2
sharkey-4151087d3cd83da8dcb0f82d4269d0f719698e0f.zip
フォロワー数、フォロー数もConditional roleで利用できるように
Diffstat (limited to 'packages/backend/src/core/UserFollowingService.ts')
-rw-r--r--packages/backend/src/core/UserFollowingService.ts5
1 files changed, 5 insertions, 0 deletions
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<void> {
+ 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),