mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-01 08:18:05 +09:00
よく話すユーザーからサスペンドされたユーザーを隠すなど (#4228)
* Resolve #4226 * fix * Fix: anonymousでアクセスするとサスペンドユーザーが隠れない * fix
This commit is contained in:
parent
f7b571cf29
commit
9783d09ee4
@ -4,7 +4,7 @@ import User, { IUser } from '../../../models/user';
|
|||||||
import { unique } from '../../../prelude/array';
|
import { unique } from '../../../prelude/array';
|
||||||
|
|
||||||
export async function getHideUserIds(me: IUser) {
|
export async function getHideUserIds(me: IUser) {
|
||||||
return me ? await getHideUserIdsById(me._id) : [];
|
return await getHideUserIdsById(me ? me._id : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getHideUserIdsById(meId?: mongo.ObjectID) {
|
export async function getHideUserIdsById(meId?: mongo.ObjectID) {
|
||||||
|
@ -4,6 +4,7 @@ import Note from '../../../../models/note';
|
|||||||
import User, { pack } from '../../../../models/user';
|
import User, { pack } from '../../../../models/user';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
import { maximum } from '../../../../prelude/array';
|
import { maximum } from '../../../../prelude/array';
|
||||||
|
import { getHideUserIds } from '../../common/get-hide-users';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: false,
|
requireCredential: false,
|
||||||
@ -62,12 +63,15 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
|||||||
return res([]);
|
return res([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hideUserIds = await getHideUserIds(me);
|
||||||
|
hideUserIds.push(user._id);
|
||||||
|
|
||||||
const replyTargetNotes = await Note.find({
|
const replyTargetNotes = await Note.find({
|
||||||
_id: {
|
_id: {
|
||||||
$in: recentNotes.map(p => p.replyId)
|
$in: recentNotes.map(p => p.replyId)
|
||||||
},
|
},
|
||||||
userId: {
|
userId: {
|
||||||
$ne: user._id
|
$nin: hideUserIds
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
|
Loading…
Reference in New Issue
Block a user