[API] notes/mentions にミュートを適用するように
This commit is contained in:
parent
f11ebafe47
commit
ac423f1ef4
|
@ -4,6 +4,7 @@ import { getFriendIds } from '../../common/get-friends';
|
||||||
import { packMany } from '../../../../models/note';
|
import { packMany } from '../../../../models/note';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
import read from '../../../../services/note/read';
|
import read from '../../../../services/note/read';
|
||||||
|
import Mute from '../../../../models/mute';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -56,6 +57,25 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||||
}]
|
}]
|
||||||
} as any;
|
} as any;
|
||||||
|
|
||||||
|
// ミュートしているユーザーを取得
|
||||||
|
const mutedUserIds = (await Mute.find({
|
||||||
|
muterId: user._id
|
||||||
|
})).map(m => m.muteeId);
|
||||||
|
|
||||||
|
if (mutedUserIds && mutedUserIds.length > 0) {
|
||||||
|
query.userId = {
|
||||||
|
$nin: mutedUserIds
|
||||||
|
};
|
||||||
|
|
||||||
|
query['_reply.userId'] = {
|
||||||
|
$nin: mutedUserIds
|
||||||
|
};
|
||||||
|
|
||||||
|
query['_renote.userId'] = {
|
||||||
|
$nin: mutedUserIds
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const sort = {
|
const sort = {
|
||||||
_id: -1
|
_id: -1
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue