From 842ec4f3d8dfc7347d954779434566044b283e3c Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 20 Nov 2017 09:09:11 +0900 Subject: [PATCH] #918 --- src/api/common/notify.ts | 8 ++++ src/web/app/desktop/tags/ui.tag | 67 ++++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/src/api/common/notify.ts b/src/api/common/notify.ts index e7ec37d4e..4b3e6a5d5 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); }); diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index f7e1bf746..908257620 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -214,7 +214,9 @@ - +
@@ -223,7 +225,7 @@ display block float left - > .header + > button display block margin 0 padding 0 @@ -243,10 +245,16 @@ &:active color darken(#9eaba8, 30%) - > i + > .icon font-size 1.2em line-height 48px + > .badge + margin-left -5px + vertical-align super + font-size 10px + color $theme-color + > .notifications display block position absolute @@ -290,8 +298,53 @@