1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-29 23:38:55 +09:00

[Server] Fix #3958

This commit is contained in:
syuilo 2019-01-22 21:21:47 +09:00
parent 7ceea61170
commit d5e80caac8
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -1,6 +1,7 @@
import $ from 'cafy'; import ID, { transform } from '../../../../misc/cafy-id'; import $ from 'cafy'; import ID, { transform } from '../../../../misc/cafy-id';
import Note, { packMany } from '../../../../models/note'; import Note, { packMany } from '../../../../models/note';
import define from '../../define'; import define from '../../define';
import Mute from '../../../../models/mute';
export const meta = { export const meta = {
desc: { desc: {
@ -33,13 +34,25 @@ export const meta = {
}; };
export default define(meta, (ps, user) => new Promise(async (res, rej) => { export default define(meta, (ps, user) => new Promise(async (res, rej) => {
// ミュートしているユーザーを取得
const mutedUserIds = user ? (await Mute.find({
muterId: user._id
})).map(m => m.muteeId) : null;
const notes = await Note.find({ const q = {
replyId: ps.noteId replyId: ps.noteId
}, { } as any;
limit: ps.limit,
skip: ps.offset if (mutedUserIds && mutedUserIds.length > 0) {
}); q['userId'] = {
$nin: mutedUserIds
};
}
const notes = await Note.find(q, {
limit: ps.limit,
skip: ps.offset
});
res(await packMany(notes, user)); res(await packMany(notes, user));
})); }));