fix: send EOSE when authors list is empty in subscriptions

Fixes: https://todo.sr.ht/~gheartsfield/nostr-rs-relay/49
This commit is contained in:
Greg Heartsfield 2022-11-19 10:00:38 -06:00
parent d0f63dc66e
commit 4de7490d97

View File

@ -471,8 +471,14 @@ fn query_from_filter(f: &ReqFilter) -> (String, Vec<Box<dyn ToSql>>) {
} }
} }
} }
if authvec.len() > 0 {
let authors_clause = format!("({})", auth_searches.join(" OR ")); let authors_clause = format!("({})", auth_searches.join(" OR "));
filter_components.push(authors_clause); filter_components.push(authors_clause);
} else {
// if the authors list was empty, we should never return
// any results.
filter_components.push("false".to_owned());
}
} }
// Query for Kind // Query for Kind
if let Some(ks) = &f.kinds { if let Some(ks) = &f.kinds {