db/events: simplify it further

This commit is contained in:
Alex Gleason 2023-12-29 21:08:59 -06:00
parent b39902d322
commit f6a8ab570f
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 3 additions and 5 deletions

View File

@ -155,11 +155,9 @@ function getFilterQuery(filter: DittoFilter): EventQuery {
}
if (typeof filter.local === 'boolean') {
query = filter.local
? query.leftJoin(usersQuery, (join) => join.onRef('users.d_tag', '=', 'events.pubkey'))
.where('users.d_tag', 'is not', null)
: query.leftJoin(usersQuery, (join) => join.onRef('users.d_tag', '=', 'events.pubkey'))
.where('users.d_tag', 'is', null);
query = query
.leftJoin(usersQuery, (join) => join.onRef('users.d_tag', '=', 'events.pubkey'))
.where('users.d_tag', filter.local ? 'is not' : 'is', null);
}
if (filter.relations?.includes('author')) {