diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-05-26 12:35:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-26 12:35:14 +0900 |
| commit | bc9487822529b260fbdc9a8dcca35c3da25db04e (patch) | |
| tree | d5fd0dffb95e03b95df8e98692305d75f855e645 /src/server/api/common | |
| parent | New translations ja.yml (Portuguese) (diff) | |
| parent | Merge pull request #1649 from l2dy/i18n (diff) | |
| download | misskey-bc9487822529b260fbdc9a8dcca35c3da25db04e.tar.gz misskey-bc9487822529b260fbdc9a8dcca35c3da25db04e.tar.bz2 misskey-bc9487822529b260fbdc9a8dcca35c3da25db04e.zip | |
Merge branch 'master' into l10n_master
Diffstat (limited to 'src/server/api/common')
| -rw-r--r-- | src/server/api/common/read-notification.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/server/api/common/read-notification.ts b/src/server/api/common/read-notification.ts index 7b9faf4cf4..cdb87a4114 100644 --- a/src/server/api/common/read-notification.ts +++ b/src/server/api/common/read-notification.ts @@ -1,6 +1,7 @@ import * as mongo from 'mongodb'; import { default as Notification, INotification } from '../../../models/notification'; import publishUserStream from '../../../publishers/stream'; +import Mute from '../../../models/mute'; /** * Mark as read notification(s) @@ -26,6 +27,11 @@ export default ( ? [new mongo.ObjectID(message)] : [(message as INotification)._id]; + const mute = await Mute.find({ + muterId: userId + }); + const mutedUserIds = mute.map(m => m.muteeId); + // Update documents await Notification.update({ _id: { $in: ids }, @@ -42,6 +48,9 @@ export default ( const count = await Notification .count({ notifieeId: userId, + notifierId: { + $nin: mutedUserIds + }, isRead: false }, { limit: 1 |