mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
replace generateBlockedHostQueryForNote allowSilenced parameter with generateSilencedUserQueryForNotes
This commit is contained in:
parent
0b9c0a6bc7
commit
7ab5ce1537
2 changed files with 5 additions and 15 deletions
|
@ -190,9 +190,8 @@ export class QueryService {
|
|||
.setParameters({ meId: me.id });
|
||||
}
|
||||
|
||||
// TODO replace allowSilenced with matchingHostQuery
|
||||
@bindThis
|
||||
public generateBlockedHostQueryForNote<E extends ObjectLiteral>(q: SelectQueryBuilder<E>, excludeAuthor?: boolean, allowSilenced = true): SelectQueryBuilder<E> {
|
||||
public generateBlockedHostQueryForNote<E extends ObjectLiteral>(q: SelectQueryBuilder<E>, excludeAuthor?: boolean): SelectQueryBuilder<E> {
|
||||
const checkFor = (key: 'user' | 'replyUser' | 'renoteUser') => {
|
||||
q.andWhere(new Brackets(qb => {
|
||||
qb.orWhere(`note.${key}Host IS NULL`); // local
|
||||
|
@ -207,18 +206,8 @@ export class QueryService {
|
|||
}
|
||||
}
|
||||
|
||||
if (allowSilenced) {
|
||||
// not blocked
|
||||
this.excludeInstanceWhere(qb, `note.${key}Host`, {
|
||||
isBlocked: false,
|
||||
}, 'orWhere');
|
||||
} else {
|
||||
// not blocked or silenced
|
||||
this.excludeInstanceWhere(qb, `note.${key}Host`, {
|
||||
isBlocked: false,
|
||||
isSilenced: false,
|
||||
}, 'orWhere');
|
||||
}
|
||||
// not blocked
|
||||
this.excludeInstanceWhere(qb, `note.${key}Host`, { isBlocked: false }, 'orWhere');
|
||||
}));
|
||||
};
|
||||
|
||||
|
|
|
@ -96,7 +96,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
if (!this.serverSettings.enableBotTrending) query.andWhere('user.isBot = FALSE');
|
||||
|
||||
this.queryService.generateBlockedHostQueryForNote(query, undefined, false);
|
||||
this.queryService.generateBlockedHostQueryForNote(query);
|
||||
this.queryService.generateSilencedUserQueryForNotes(query, me);
|
||||
if (me) this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||
if (me) this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
if (me) this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
|
||||
|
|
Loading…
Add table
Reference in a new issue