Merge branch 'eventsdb-crash' into 'main'

EventsDB: fix postgres crash when there are no local users

See merge request soapbox-pub/ditto!239
This commit is contained in:
Alex Gleason 2024-05-08 22:14:39 +00:00
commit 06a1612750
1 changed files with 1 additions and 3 deletions

View File

@ -235,8 +235,6 @@ class EventsDB implements NStore {
/** Converts filters to more performant, simpler filters that are better for SQLite. */ /** Converts filters to more performant, simpler filters that are better for SQLite. */
async expandFilters(filters: NostrFilter[]): Promise<NostrFilter[]> { async expandFilters(filters: NostrFilter[]): Promise<NostrFilter[]> {
filters = normalizeFilters(filters); // Improves performance of `{ kinds: [0], authors: ['...'] }` queries.
for (const filter of filters) { for (const filter of filters) {
if (filter.search) { if (filter.search) {
const tokens = NIP50.parseInput(filter.search); const tokens = NIP50.parseInput(filter.search);
@ -268,7 +266,7 @@ class EventsDB implements NStore {
} }
} }
return filters; return normalizeFilters(filters); // Improves performance of `{ kinds: [0], authors: ['...'] }` queries.
} }
/** Get events for filters from the database. */ /** Get events for filters from the database. */