diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-11-22 12:29:04 +0000 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-11-22 12:29:04 +0000 |
| commit | bc816cb166d907d38eb096a02c5f4f57d9a2f1a0 (patch) | |
| tree | a0e6b1dfeed8aa2b0543846eb65b8aae0ce631ad /packages/backend/src/core/NoteCreateService.ts | |
| parent | better wording for moderator inactivity messages (diff) | |
| parent | Release: 2024.11.0 (diff) | |
| download | sharkey-bc816cb166d907d38eb096a02c5f4f57d9a2f1a0.tar.gz sharkey-bc816cb166d907d38eb096a02c5f4f57d9a2f1a0.tar.bz2 sharkey-bc816cb166d907d38eb096a02c5f4f57d9a2f1a0.zip | |
Merge tag '2024.11.0' into feature/2024.10
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteCreateService.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 13bafb7883..ae98c2fc79 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -58,6 +58,7 @@ import { isUserRelated } from '@/misc/is-user-related.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; import { LatestNoteService } from '@/core/LatestNoteService.js'; import { CollapsedQueue } from '@/misc/collapsed-queue.js'; +import { CacheService } from '@/core/CacheService.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -608,13 +609,21 @@ export class NoteCreateService implements OnApplicationShutdown { this.followingsRepository.findBy({ followeeId: user.id, notify: 'normal', - }).then(followings => { + }).then(async followings => { if (note.visibility !== 'specified') { + const isPureRenote = this.isRenote(data) && !this.isQuote(data) ? true : false; for (const following of followings) { // TODO: ワードミュート考慮 - this.notificationService.createNotification(following.followerId, 'note', { - noteId: note.id, - }, user.id); + let isRenoteMuted = false; + if (isPureRenote) { + const userIdsWhoMeMutingRenotes = await this.cacheService.renoteMutingsCache.fetch(following.followerId); + isRenoteMuted = userIdsWhoMeMutingRenotes.has(user.id); + } + if (!isRenoteMuted) { + this.notificationService.createNotification(following.followerId, 'note', { + noteId: note.id, + }, user.id); + } } } }); |