From 8ed1bda0174b64eb97242784230c640a39b4c996 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 23 Nov 2023 22:17:12 +0100 Subject: [PATCH] [backend] Don't emit followRequestAccepted if followee is not locked Resolves #395 --- packages/backend/src/services/following/create.ts | 11 +++++++---- .../backend/src/services/following/requests/accept.ts | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/services/following/create.ts b/packages/backend/src/services/following/create.ts index 3a77676b3..617073b66 100644 --- a/packages/backend/src/services/following/create.ts +++ b/packages/backend/src/services/following/create.ts @@ -38,6 +38,7 @@ export async function insertFollowingDoc( uri: User["host"]; inbox: User["inbox"]; sharedInbox: User["sharedInbox"]; + isLocked: User["isLocked"]; }, follower: { id: User["id"]; @@ -92,10 +93,12 @@ export async function insertFollowingDoc( followerId: follower.id, }); - // Create notification that request was accepted. - createNotification(follower.id, "followRequestAccepted", { - notifierId: followee.id, - }); + if (followee.isLocked) { + // Create notification that request was accepted. + createNotification(follower.id, "followRequestAccepted", { + notifierId: followee.id, + }); + } } if (alreadyFollowed) return; diff --git a/packages/backend/src/services/following/requests/accept.ts b/packages/backend/src/services/following/requests/accept.ts index 6aa17b09a..800b139a1 100644 --- a/packages/backend/src/services/following/requests/accept.ts +++ b/packages/backend/src/services/following/requests/accept.ts @@ -16,6 +16,7 @@ export default async function ( uri: User["host"]; inbox: User["inbox"]; sharedInbox: User["sharedInbox"]; + isLocked: User["isLocked"]; }, follower: CacheableUser, ) {