Fix #2741
This commit is contained in:
parent
a5f817d896
commit
00a3f8d392
1 changed files with 8 additions and 8 deletions
|
@ -5,6 +5,14 @@ import Mute from '../../models/mute';
|
||||||
import { publishUserStream } from '../../stream';
|
import { publishUserStream } from '../../stream';
|
||||||
|
|
||||||
export default async function(user: IUser, note: INote, isSpecified = false) {
|
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({
|
const unread = await NoteUnread.insert({
|
||||||
noteId: note._id,
|
noteId: note._id,
|
||||||
userId: user._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 });
|
const exist = await NoteUnread.findOne({ _id: unread._id });
|
||||||
if (exist == null) return;
|
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({
|
User.update({
|
||||||
_id: user._id
|
_id: user._id
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Reference in a new issue