mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-08 05:43:09 +02:00
[Server] Fix #3958
This commit is contained in:
parent
7ceea61170
commit
d5e80caac8
1 changed files with 19 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
import $ from 'cafy'; import ID, { transform } from '../../../../misc/cafy-id';
|
||||
import Note, { packMany } from '../../../../models/note';
|
||||
import define from '../../define';
|
||||
import Mute from '../../../../models/mute';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
|
@ -33,10 +34,22 @@ export const meta = {
|
|||
};
|
||||
|
||||
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
|
||||
}, {
|
||||
} as any;
|
||||
|
||||
if (mutedUserIds && mutedUserIds.length > 0) {
|
||||
q['userId'] = {
|
||||
$nin: mutedUserIds
|
||||
};
|
||||
}
|
||||
|
||||
const notes = await Note.find(q, {
|
||||
limit: ps.limit,
|
||||
skip: ps.offset
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue