Refactor: Extract shouldMuteThisNote function

This commit is contained in:
syuilo
2018-09-17 23:07:15 +09:00
parent 311b4e90ca
commit 44f6fe6f1f
6 changed files with 29 additions and 53 deletions

View File

@ -8,6 +8,7 @@ import { pack as packNote, pack } from '../../../models/note';
import readNotification from '../common/read-notification';
import call from '../call';
import { IApp } from '../../../models/app';
import shouldMuteThisNote from '../../../misc/should-mute-this-note';
const log = debug('misskey');
@ -45,15 +46,7 @@ export default async function(
//#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する
if (x.type == 'note') {
if (mutedUserIds.includes(x.body.userId)) {
return;
}
if (x.body.reply != null && mutedUserIds.includes(x.body.reply.userId)) {
return;
}
if (x.body.renote != null && mutedUserIds.includes(x.body.renote.userId)) {
return;
}
if (shouldMuteThisNote(x.body, mutedUserIds)) return;
} else if (x.type == 'notification') {
if (mutedUserIds.includes(x.body.userId)) {
return;