cherrypick improve mutes and blocks from foundkey
Some checks failed
Check Misskey JS version / Check version (pull_request) Successful in 10s
API report (misskey.js) / report (pull_request) Successful in 49s
Lint / pnpm_install (pull_request) Successful in 47s
Test (misskey.js) / test (22.x) (pull_request) Successful in 53s
Test (frontend) / vitest (22.x) (pull_request) Successful in 1m23s
Test (production install and build) / production (22.x) (pull_request) Successful in 1m3s
Test (backend) / validate-api-json (22.x) (pull_request) Successful in 1m42s
Test (backend) / unit (22.x) (pull_request) Successful in 2m32s
Lint / lint (backend) (pull_request) Failing after 58s
Lint / lint (misskey-js) (pull_request) Successful in 34s
Lint / lint (sw) (pull_request) Successful in 33s
Lint / typecheck (misskey-js) (pull_request) Successful in 34s
Lint / typecheck (backend) (pull_request) Failing after 49s
Test (backend) / e2e (22.x) (pull_request) Failing after 6m35s
Lint / lint (frontend) (pull_request) Successful in 7m42s
Some checks failed
Check Misskey JS version / Check version (pull_request) Successful in 10s
API report (misskey.js) / report (pull_request) Successful in 49s
Lint / pnpm_install (pull_request) Successful in 47s
Test (misskey.js) / test (22.x) (pull_request) Successful in 53s
Test (frontend) / vitest (22.x) (pull_request) Successful in 1m23s
Test (production install and build) / production (22.x) (pull_request) Successful in 1m3s
Test (backend) / validate-api-json (22.x) (pull_request) Successful in 1m42s
Test (backend) / unit (22.x) (pull_request) Successful in 2m32s
Lint / lint (backend) (pull_request) Failing after 58s
Lint / lint (misskey-js) (pull_request) Successful in 34s
Lint / lint (sw) (pull_request) Successful in 33s
Lint / typecheck (misskey-js) (pull_request) Successful in 34s
Lint / typecheck (backend) (pull_request) Failing after 49s
Test (backend) / e2e (22.x) (pull_request) Failing after 6m35s
Lint / lint (frontend) (pull_request) Successful in 7m42s
This commit is contained in:
parent
f4bda8582f
commit
b60c86ae6e
1 changed files with 6 additions and 12 deletions
|
@ -3,18 +3,12 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function isUserRelated(note: any, userIds: Set<string>, ignoreAuthor = false): boolean {
|
//Cherrypicked mute fix from foundkey: https://akkoma.dev/FoundKeyGang/FoundKey/pulls/32
|
||||||
if (userIds.has(note.userId) && !ignoreAuthor) {
|
export function isUserRelated(note: any, ids: Set<string>): boolean {
|
||||||
return true;
|
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.reply != null && note.reply.userId !== note.userId && userIds.has(note.reply.userId)) {
|
if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (note.renote != null && note.renote.userId !== note.userId && userIds.has(note.renote.userId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue