From a72eaec3b8c6533194c53d1facfcda8fddc6d65b Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Tue, 25 Jan 2022 20:48:46 -0600 Subject: [PATCH] fix: never display hidden events --- src/db.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/db.rs b/src/db.rs index 0b0103f..dfeee9d 100644 --- a/src/db.rs +++ b/src/db.rs @@ -612,16 +612,17 @@ fn query_from_sub(sub: &Subscription) -> (String, Vec>) { 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");