diff options
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/common/notify.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/api/common/notify.ts b/src/api/common/notify.ts index e7ec37d4e4..4b3e6a5d54 100644 --- a/src/api/common/notify.ts +++ b/src/api/common/notify.ts @@ -27,4 +27,12 @@ export default ( // Publish notification event event(notifiee, 'notification', await serialize(notification)); + + // 3秒経っても(今回作成した)通知が既読にならなかったら「未読の通知がありますよ」イベントを発行する + setTimeout(async () => { + const fresh = await Notification.findOne({ _id: notification._id }, { is_read: true }); + if (!fresh.is_read) { + event(notifiee, 'unread_notification', await serialize(notification)); + } + }, 3000); }); |