diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-05-29 01:22:39 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-05-29 01:22:39 +0900 |
| commit | ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625 (patch) | |
| tree | 26de7290eede6b42a661f328adce965a889f9887 /src/server/api/common/read-notification.ts | |
| parent | typo (diff) | |
| download | sharkey-ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625.tar.gz sharkey-ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625.tar.bz2 sharkey-ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625.zip | |
#1634
Diffstat (limited to 'src/server/api/common/read-notification.ts')
| -rw-r--r-- | src/server/api/common/read-notification.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/server/api/common/read-notification.ts b/src/server/api/common/read-notification.ts index cdb87a4114..6505c58c39 100644 --- a/src/server/api/common/read-notification.ts +++ b/src/server/api/common/read-notification.ts @@ -2,6 +2,7 @@ import * as mongo from 'mongodb'; import { default as Notification, INotification } from '../../../models/notification'; import publishUserStream from '../../../publishers/stream'; import Mute from '../../../models/mute'; +import User from '../../../models/user'; /** * Mark as read notification(s) @@ -57,6 +58,13 @@ export default ( }); if (count == 0) { + // Update flag + User.update({ _id: userId }, { + $set: { + hasUnreadNotification: false + } + }); + // 全ての(いままで未読だった)通知を(これで)読みましたよというイベントを発行 publishUserStream(userId, 'read_all_notifications'); } |