Filter hidden replies / mentions (#3981)
* Fix: 非公開投稿が返信一覧に出てくる * Fix: 非公開投稿がメンション一覧に出てくる * 非公開投稿は通知/メンション通知しない * repliesにフォロワー限定がかからなかったのを修正 * Fix: ホームにフォロワー限定投稿が表示されない * 認証必須エンドポイントで user == null にはならない * mentionsにフォロワー限定がかからなかったのを修正
This commit is contained in:
parent
d731c7da13
commit
5eca0a31f7
4 changed files with 56 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
import $ from 'cafy'; import ID, { transform } from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import { getFriendIds } from '../../common/get-friends';
|
||||
import { getFriendIds, getFriends } from '../../common/get-friends';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import define from '../../define';
|
||||
import read from '../../../../services/note/read';
|
||||
|
@ -47,8 +47,28 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
|||
return rej('cannot set sinceId and untilId');
|
||||
}
|
||||
|
||||
// フォローを取得
|
||||
const followings = await getFriends(user._id);
|
||||
|
||||
const visibleQuery = [{
|
||||
visibility: { $in: [ 'public', 'home' ] }
|
||||
}, {
|
||||
// myself (for specified/private)
|
||||
userId: user._id
|
||||
}, {
|
||||
// to me (for specified)
|
||||
visibleUserIds: { $in: [ user._id ] }
|
||||
}, {
|
||||
visibility: 'followers',
|
||||
userId: { $in: followings.map(f => f.id) }
|
||||
}];
|
||||
|
||||
const query = {
|
||||
deletedAt: null,
|
||||
$and: [{
|
||||
deletedAt: null,
|
||||
}, {
|
||||
$or: visibleQuery,
|
||||
}],
|
||||
|
||||
$or: [{
|
||||
mentions: user._id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue