mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 04:04:16 +00:00
replace generateBlockedHostQueryForNote allowSilenced parameter with generateSilencedUserQueryForNotes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user