Hide suspended users (#4075)

This commit is contained in:
MeiMei
2019-02-01 09:57:51 +09:00
committed by syuilo
parent 9bf9519b8f
commit c7ebf6f990
12 changed files with 94 additions and 98 deletions

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import Vote from '../../../../../models/poll-vote';
import Note, { pack } from '../../../../../models/note';
import define from '../../../define';
import Mute from '../../../../../models/mute';
import { getHideUserIds } from '../../../common/get-hide-users';
export const meta = {
desc: {
@ -38,10 +38,8 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
const nin = votes && votes.length != 0 ? votes.map(v => v.noteId) : [];
// ミュートしているユーザーを取得
const mutedUserIds = await Mute.find({
muterId: user._id
}).then(ms => ms.map(m => m.muteeId));
// 隠すユーザーを取得
const hideUserIds = await getHideUserIds(user);
const notes = await Note
.find({
@ -51,7 +49,7 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
},
userId: {
$ne: user._id,
$nin: mutedUserIds
$nin: hideUserIds
},
poll: {
$exists: true,