merge: don't send real-time updates of replies to blocked users #457 #573 (!566)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/566

Approved-by: Tess K <me@thvxl.se>
Approved-by: fEmber <acomputerdog@gmail.com>
This commit is contained in:
dakkar 2024-08-06 09:26:40 +00:00
commit 712af44de4
3 changed files with 14 additions and 0 deletions

View file

@ -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,