cherrypick improve mutes and blocks #61

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

View file

@ -4,8 +4,8 @@
*/ */
//Cherrypicked mute fix from foundkey: https://akkoma.dev/FoundKeyGang/FoundKey/pulls/32 //Cherrypicked mute fix from foundkey: https://akkoma.dev/FoundKeyGang/FoundKey/pulls/32
export function isUserRelated(note: any, ids: Set<string>): boolean { export function isUserRelated(note: any, ids: Set<string>, ignoreAuthor = false): boolean {
if (ids.has(note.userId)) return true; // note author is muted if (ids.has(note.userId) && !ignoreAuthor) return true; // note author is muted (unless ignoreAuthor is false)
if (note.mentions && note.mentions.some((user: string) => ids.has(user))) return true; // any of mentioned users are 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.reply && isUserRelated(note.reply, ids)) return true; // also check reply target
if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target