merge: Hide renotes where the user being replied to is muted. (!794)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/794
This commit is contained in:
commit
4a52805b30
2 changed files with 16 additions and 0 deletions
|
|
@ -88,6 +88,12 @@ export class QueryService {
|
|||
qb
|
||||
.where('note.renoteUserId IS NULL')
|
||||
.orWhere(`note.renoteUserId NOT IN (${ blockingQuery.getQuery() })`);
|
||||
}))
|
||||
// filter out renotes where the user being replied to is muted.
|
||||
.andWhere(new Brackets(qb => {
|
||||
qb
|
||||
.where('(SELECT "replyUserId" FROM note n WHERE "n".id = note.renoteId) IS NULL')
|
||||
.orWhere(`(SELECT "replyUserId" FROM note n WHERE "n".id = note.renoteId) NOT IN (${ blockingQuery.getQuery() })`);
|
||||
}));
|
||||
|
||||
q.setParameters(blockingQuery.getParameters());
|
||||
|
|
@ -155,6 +161,12 @@ export class QueryService {
|
|||
.where('note.renoteUserId IS NULL')
|
||||
.orWhere(`note.renoteUserId NOT IN (${ mutingQuery.getQuery() })`);
|
||||
}))
|
||||
// filter out renotes where the user being replied to is muted.
|
||||
.andWhere(new Brackets(qb => {
|
||||
qb
|
||||
.where('(SELECT "replyUserId" FROM note n WHERE "n".id = note.renoteId) IS NULL')
|
||||
.orWhere(`(SELECT "replyUserId" FROM note n WHERE "n".id = note.renoteId) NOT IN (${ mutingQuery.getQuery() })`);
|
||||
}))
|
||||
// mute instances
|
||||
.andWhere(new Brackets(qb => {
|
||||
qb
|
||||
|
|
|
|||
|
|
@ -20,5 +20,9 @@ export function isUserRelated(note: any, userIds: Set<string>, ignoreAuthor = fa
|
|||
return true;
|
||||
}
|
||||
|
||||
if (note.renote?.replyUserId != null && note.renote?.replyUserId !== note.userId && userIds.has(note.renote?.replyUserId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue