summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-07-06 11:35:52 +0100
committerdakkar <dakkar@thenautilus.net>2024-07-06 11:35:52 +0100
commitf086bc23f59bb2d201e8423e940ac41611e4d25a (patch)
treee4bb137b1cdae9c1072ffbd7c4bee0d37b128772 /packages/backend/src/server/api
parentmerge: cache URL previews on the server (!565) (diff)
downloadsharkey-f086bc23f59bb2d201e8423e940ac41611e4d25a.tar.gz
sharkey-f086bc23f59bb2d201e8423e940ac41611e4d25a.tar.bz2
sharkey-f086bc23f59bb2d201e8423e940ac41611e4d25a.zip
don't send real-time updates of replies to blocked users
this is in line with the behaviour of a note's detailed view, which does not show me replies from users who blocked me
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/stream/Connection.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/stream/Connection.ts b/packages/backend/src/server/api/stream/Connection.ts
index 41c0feccc7..7dd7db24e5 100644
--- a/packages/backend/src/server/api/stream/Connection.ts
+++ b/packages/backend/src/server/api/stream/Connection.ts
@@ -201,6 +201,18 @@ export default class Connection {
@bindThis
private async onNoteStreamMessage(data: GlobalEvents['note']['payload']) {
+ // we must not send to the frontend information about notes from
+ // users who blocked the logged-in user, even when they're replies
+ // to notes the logged-in user can see
+ if (data.type === 'replied') {
+ const noteUserId = data.body.body.userId;
+ if (noteUserId !== null) {
+ if (this.userIdsWhoBlockingMe.has(noteUserId)) {
+ return;
+ }
+ }
+ }
+
this.sendMessageToWs('noteUpdated', {
id: data.body.id,
type: data.type,