This commit is contained in:
syuilo
2017-11-20 09:09:11 +09:00
parent 88804731d0
commit 842ec4f3d8
2 changed files with 69 additions and 6 deletions

View File

@ -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);
});