[backend] Add instance:local postgres FTS filter

This commit is contained in:
Laura Hausmann 2023-11-18 21:59:28 +01:00
parent e1ae37dbdb
commit 98f40d8865
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
2 changed files with 10 additions and 6 deletions

View File

@ -134,8 +134,12 @@ function afterFilter(query: SelectQueryBuilder<any>, filter: string) {
}
function instanceFilter(query: SelectQueryBuilder<any>, filter: string, id: number) {
query.andWhere(`note.userHost = :instance_${id}`);
query.setParameter(`instance_${id}`, filter);
if (filter === 'local') {
query.andWhere(`note.userHost IS NULL`);
} else {
query.andWhere(`note.userHost = :instance_${id}`);
query.setParameter(`instance_${id}`, filter);
}
}
function instanceFilterInverse(query: SelectQueryBuilder<any>, filter: string, id: number) {

View File

@ -28,10 +28,10 @@
<div class="section _block">
<div class="title">{{ i18n.ts._filters._dialog.userDomain }}</div>
<div class="content">
<p><code>[-]from:[@]user[@host.tld]</code></p>
<p><code>[-]mention:[@]user[@host.tld]</code></p>
<p><code>[-]reply:[@]user[@host.tld]</code></p>
<p><code>[-]instance:domain.tld</code></p>
<p><code>[-]from:[@]user[@domain.tld]</code></p>
<p><code>[-]mention:[@]user[@domain.tld]</code></p>
<p><code>[-]reply:[@]user[@domain.tld]</code></p>
<p><code>[-]instance:local|domain.tld</code></p>
</div>
</div>
<div class="section _block">