cherrypick improve mutes and blocks #61

Open
leah wants to merge 5 commits from mute-fix into main
Showing only changes of commit b60c86ae6e - Show all commits

View file

@ -3,18 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
export function isUserRelated(note: any, userIds: Set<string>, ignoreAuthor = false): boolean {
if (userIds.has(note.userId) && !ignoreAuthor) {
return true;
}
if (note.reply != null && note.reply.userId !== note.userId && userIds.has(note.reply.userId)) {
return true;
}
if (note.renote != null && note.renote.userId !== note.userId && userIds.has(note.renote.userId)) {
return true;
}
//Cherrypicked mute fix from foundkey: https://akkoma.dev/FoundKeyGang/FoundKey/pulls/32
export function isUserRelated(note: any, ids: Set<string>): boolean {
if (ids.has(note.userId)) return true; // note author is muted
if (note.mentions && note.mentions.some((user: string) => ids.has(user))) return true; // any of mentioned users are muted
if (note.reply && isUserRelated(note.reply, ids)) return true; // also check reply target
if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target
return false;
}