chore: check for mute / block for renote of note with FTT
This commit is contained in:
parent
5d7a5d5687
commit
a108a197aa
|
@ -120,6 +120,8 @@ export class FanoutTimelineEndpointService {
|
|||
filter = (note) => {
|
||||
if (isUserRelated(note, userIdsWhoBlockingMe, ps.ignoreAuthorFromBlock)) return false;
|
||||
if (isUserRelated(note, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
|
||||
if (isUserRelated(note.renote, userIdsWhoBlockingMe, ps.ignoreAuthorFromBlock)) return false;
|
||||
if (isUserRelated(note.renote, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
|
||||
if (!ps.ignoreAuthorFromMute && isRenote(note) && !isQuote(note) && userIdsWhoMeMutingRenotes.has(note.userId)) return false;
|
||||
if (isInstanceMuted(note, userMutedInstances)) return false;
|
||||
|
||||
|
|
|
@ -3,7 +3,17 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export function isUserRelated(note: any, userIds: Set<string>, ignoreAuthor = false): boolean {
|
||||
import type { MiUser } from '@/models/_.js';
|
||||
|
||||
interface NoteLike {
|
||||
userId: MiUser['id'];
|
||||
reply?: NoteLike | null;
|
||||
renote?: NoteLike | null;
|
||||
replyUserId?: MiUser['id'] | null;
|
||||
renoteUserId?: MiUser['id'] | null;
|
||||
}
|
||||
|
||||
export function isUserRelated(note: NoteLike | null, userIds: Set<string>, ignoreAuthor = false): boolean {
|
||||
if (!note) {
|
||||
return false;
|
||||
}
|
||||
|
@ -12,13 +22,16 @@ export function isUserRelated(note: any, userIds: Set<string>, ignoreAuthor = fa
|
|||
return true;
|
||||
}
|
||||
|
||||
if (note.reply != null && note.reply.userId !== note.userId && userIds.has(note.reply.userId)) {
|
||||
const replyUserId = note.replyUserId ?? note.reply?.userId;
|
||||
if (replyUserId != null && replyUserId !== note.userId && userIds.has(replyUserId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.renote != null && note.renote.userId !== note.userId && userIds.has(note.renote.userId)) {
|
||||
const renoteUserId = note.renoteUserId ?? note.renote?.userId;
|
||||
if (renoteUserId != null && renoteUserId !== note.userId && userIds.has(renoteUserId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue