diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index f03316744d..419e58ec62 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -57,8 +57,10 @@ import { FeaturedService } from '@/core/FeaturedService.js'; import { FanoutTimelineService } from '@/core/FanoutTimelineService.js'; import { UtilityService } from '@/core/UtilityService.js'; import { UserBlockingService } from '@/core/UserBlockingService.js'; +import { CacheService } from '@/core/CacheService.js'; import { isReply } from '@/misc/is-reply.js'; import { trackPromise } from '@/misc/promise-tracker.js'; +import { isUserRelated } from '@/misc/is-user-related.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -217,6 +219,7 @@ export class NoteCreateService implements OnApplicationShutdown { private instanceChart: InstanceChart, private utilityService: UtilityService, private userBlockingService: UserBlockingService, + private cacheService: CacheService, ) { } @bindThis @@ -796,7 +799,15 @@ export class NoteCreateService implements OnApplicationShutdown { }, }); - if (!isThreadMuted) { + const [ + userIdsWhoMeMuting, + ] = data.reply.userId ? await Promise.all([ + this.cacheService.userMutingsCache.fetch(data.reply.userId), + ]) : [new Set()]; + + const muted = isUserRelated(note, userIdsWhoMeMuting); + + if (!isThreadMuted || !muted) { nm.push(data.reply.userId, 'reply'); this.globalEventService.publishMainStream(data.reply.userId, 'reply', noteObj); @@ -823,7 +834,15 @@ export class NoteCreateService implements OnApplicationShutdown { }, }); - if (!isThreadMuted) { + const [ + userIdsWhoMeMuting, + ] = data.renote.userId ? await Promise.all([ + this.cacheService.userMutingsCache.fetch(data.renote.userId), + ]) : [new Set()]; + + const muted = isUserRelated(note, userIdsWhoMeMuting); + + if (!isThreadMuted || !muted) { nm.push(data.renote.userId, type); } } @@ -1042,7 +1061,15 @@ export class NoteCreateService implements OnApplicationShutdown { }, }); - if (isThreadMuted) { + const [ + userIdsWhoMeMuting, + ] = u.id ? await Promise.all([ + this.cacheService.userMutingsCache.fetch(u.id), + ]) : [new Set()]; + + const muted = isUserRelated(note, userIdsWhoMeMuting); + + if (isThreadMuted || muted) { continue; }