From 187c98e5acb4e20df263a914ae64c72a6414da60 Mon Sep 17 00:00:00 2001 From: Jacob Hall Date: Thu, 20 Feb 2025 15:09:48 -0500 Subject: do not notify mentioned users if a DM is not visible to them --- packages/backend/src/core/NoteCreateService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/backend/src/core/NoteCreateService.ts') diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 3bfced1d80..a907b4a42f 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -861,7 +861,8 @@ export class NoteCreateService implements OnApplicationShutdown { @bindThis private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) { - for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) { + // Only create mention events for local users, and users for whom the note is visible + for (const u of mentionedUsers.filter(u => (note.visibility !== 'specified' || note.visibleUserIds.some(x => x === u.id)) && this.userEntityService.isLocalUser(u))) { const isThreadMuted = await this.noteThreadMutingsRepository.exists({ where: { userId: u.id, -- cgit v1.2.3-freya