[backend] Make postgres FTS filter: filters slightly more typo-safe

This commit is contained in:
Laura Hausmann 2023-11-18 19:00:30 +01:00
parent b7a5c192d8
commit b2f6808bef
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
2 changed files with 4 additions and 4 deletions

View File

@ -147,9 +147,9 @@ function miscFilter(query: SelectQueryBuilder<any>, filter: string) {
subQuery = Followings.createQueryBuilder('following') subQuery = Followings.createQueryBuilder('following')
.select('following.followeeId') .select('following.followeeId')
.where('following.followerId = :meId') .where('following.followerId = :meId')
} else if (filter === 'replies') { } else if (filter === 'replies' || filter === 'reply') {
query.andWhere('note.replyId IS NOT NULL'); query.andWhere('note.replyId IS NOT NULL');
} else if (filter === 'boosts' || filter === 'renotes') { } else if (filter === 'boosts' || filter === 'boost' || filter === 'renotes' || filter === 'renote') {
query.andWhere('note.renoteId IS NOT NULL'); query.andWhere('note.renoteId IS NOT NULL');
} }
@ -168,7 +168,7 @@ function miscFilterInverse(query: SelectQueryBuilder<any>, filter: string) {
.where('following.followerId = :meId') .where('following.followerId = :meId')
} else if (filter === 'replies') { } else if (filter === 'replies') {
query.andWhere('note.replyId IS NULL'); query.andWhere('note.replyId IS NULL');
} else if (filter === 'boosts' || filter === 'renotes') { } else if (filter === 'boosts' || filter === 'boost' || filter === 'renotes' || filter === 'renote') {
query.andWhere('note.renoteId IS NULL'); query.andWhere('note.renoteId IS NULL');
} }

View File

@ -30,7 +30,7 @@
<div class="section _block"> <div class="section _block">
<div class="title">{{ i18n.ts._filters._dialog.miscFilters }}</div> <div class="title">{{ i18n.ts._filters._dialog.miscFilters }}</div>
<div class="content"> <div class="content">
<p><code>[-]filter:followers|following|replies|renotes|boosts</code></p> <p><code>[-]filter:followers|following|replies|reply|renote[s]|boost[s]</code></p>
</div> </div>
</div> </div>
<div class="section _block"> <div class="section _block">