diff options
| author | zyoshoka <107108195+zyoshoka@users.noreply.github.com> | 2024-07-25 16:32:07 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-25 16:32:07 +0900 |
| commit | fc71bcc98e14f9c3c13ba74ade9245d64bd4b633 (patch) | |
| tree | 7d86ea64e1ec2878f25c09c2ce3d289e41c02df0 /packages/backend/src/queue/processors | |
| parent | fix(frontend): 初期化時とroute変更時でkeyの決定方法が違うの... (diff) | |
| download | sharkey-fc71bcc98e14f9c3c13ba74ade9245d64bd4b633.tar.gz sharkey-fc71bcc98e14f9c3c13ba74ade9245d64bd4b633.tar.bz2 sharkey-fc71bcc98e14f9c3c13ba74ade9245d64bd4b633.zip | |
fix(backend): avoid notifying to remote users on local (#13774)
* fix(backend): avoid notifying to remote users on local
* Update CHANGELOG.md
* refactor: check before calling method
---------
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/queue/processors')
| -rw-r--r-- | packages/backend/src/queue/processors/EndedPollNotificationProcessorService.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/backend/src/queue/processors/EndedPollNotificationProcessorService.ts b/packages/backend/src/queue/processors/EndedPollNotificationProcessorService.ts index 29c1f27bb1..34180e5f2b 100644 --- a/packages/backend/src/queue/processors/EndedPollNotificationProcessorService.ts +++ b/packages/backend/src/queue/processors/EndedPollNotificationProcessorService.ts @@ -7,6 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { PollVotesRepository, NotesRepository } from '@/models/_.js'; import type Logger from '@/logger.js'; +import { CacheService } from '@/core/CacheService.js'; import { NotificationService } from '@/core/NotificationService.js'; import { bindThis } from '@/decorators.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; @@ -24,6 +25,7 @@ export class EndedPollNotificationProcessorService { @Inject(DI.pollVotesRepository) private pollVotesRepository: PollVotesRepository, + private cacheService: CacheService, private notificationService: NotificationService, private queueLoggerService: QueueLoggerService, ) { @@ -47,9 +49,12 @@ export class EndedPollNotificationProcessorService { const userIds = [...new Set([note.userId, ...votes.map(v => v.userId)])]; for (const userId of userIds) { - this.notificationService.createNotification(userId, 'pollEnded', { - noteId: note.id, - }); + const profile = await this.cacheService.userProfileCache.fetch(userId); + if (profile.userHost === null) { + this.notificationService.createNotification(userId, 'pollEnded', { + noteId: note.id, + }); + } } } } |