nostr-rs-relay

My dev fork of nostr-rs-relay
git clone git://jb55.com/nostr-rs-relay
Log | Files | Refs | README | LICENSE

commit a72eaec3b8c6533194c53d1facfcda8fddc6d65b
parent f1206e76f2b94a6ef0833c5b7d278418705e470c
Author: Greg Heartsfield <scsibug@imap.cc>
Date:   Tue, 25 Jan 2022 20:48:46 -0600

fix: never display hidden events

Diffstat:
Msrc/db.rs | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/db.rs b/src/db.rs @@ -612,16 +612,17 @@ fn query_from_sub(sub: &Subscription) -> (String, Vec<Box<dyn ToSql>>) { fc.push_str(&filter_components.join(" AND ")); fc.push_str(" )"); filter_clauses.push(fc); - } else { - // never display hidden events - filter_clauses.push("hidden!=TRUE".to_owned()); } } + // never display hidden events + query.push_str(" WHERE hidden!=TRUE "); + // combine all filters with OR clauses, if any exist if !filter_clauses.is_empty() { - query.push_str(" WHERE "); + query.push_str(" AND ("); query.push_str(&filter_clauses.join(" OR ")); + query.push_str(") "); } // add order clause query.push_str(" ORDER BY created_at ASC");