おすすめのアンケートでミュートユーザーのものは表示しない (#4067)
This commit is contained in:
parent
6d3408ae73
commit
c34a278533
1 changed files with 8 additions and 1 deletions
|
@ -2,6 +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';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
|
@ -37,6 +38,11 @@ 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 notes = await Note
|
||||
.find({
|
||||
'_user.host': null,
|
||||
|
@ -44,7 +50,8 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
|||
$nin: nin
|
||||
},
|
||||
userId: {
|
||||
$ne: user._id
|
||||
$ne: user._id,
|
||||
$nin: mutedUserIds
|
||||
},
|
||||
poll: {
|
||||
$exists: true,
|
||||
|
|
Loading…
Reference in a new issue