diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-21 08:37:26 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-21 08:37:26 +0900 |
| commit | 00a3f8d3929c55a165f6f00877c847162139d5c6 (patch) | |
| tree | 50e36b5931d735c013b976d6ba5b085e8752069f /src/services | |
| parent | Fix #2744 (diff) | |
| download | sharkey-00a3f8d3929c55a165f6f00877c847162139d5c6.tar.gz sharkey-00a3f8d3929c55a165f6f00877c847162139d5c6.tar.bz2 sharkey-00a3f8d3929c55a165f6f00877c847162139d5c6.zip | |
Fix #2741
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/note/unread.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/services/note/unread.ts b/src/services/note/unread.ts index 6e10c8b248..2d50976283 100644 --- a/src/services/note/unread.ts +++ b/src/services/note/unread.ts @@ -5,6 +5,14 @@ import Mute from '../../models/mute'; import { publishUserStream } from '../../stream'; export default async function(user: IUser, note: INote, isSpecified = false) { + //#region ミュートしているなら無視 + const mute = await Mute.find({ + muterId: user._id + }); + const mutedUserIds = mute.map(m => m.muteeId.toString()); + if (mutedUserIds.includes(note.userId.toString())) return; + //#endregion + const unread = await NoteUnread.insert({ noteId: note._id, userId: user._id, @@ -19,14 +27,6 @@ export default async function(user: IUser, note: INote, isSpecified = false) { const exist = await NoteUnread.findOne({ _id: unread._id }); if (exist == null) return; - //#region ただしミュートされているなら発行しない - const mute = await Mute.find({ - muterId: user._id - }); - const mutedUserIds = mute.map(m => m.muteeId.toString()); - if (mutedUserIds.includes(note.userId.toString())) return; - //#endregion - User.update({ _id: user._id }, { |