notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 2936012308a8a4b57b1d7047489e0d6e71ee6528
parent 450709afa756001e52c0827ea539332846cf7946
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 22 Mar 2024 10:23:41 +0100

filters: fix hashtag filters

We might need to move to something a bit more generic that works
for all generic tag filters.

Diffstat:
Menostr/src/filter.rs | 4++++
Msrc/filter.rs | 5+++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/enostr/src/filter.rs b/enostr/src/filter.rs @@ -15,6 +15,9 @@ pub struct Filter { #[serde(rename = "#p")] #[serde(skip_serializing_if = "Option::is_none")] pub pubkeys: Option<Vec<Pubkey>>, + #[serde(rename = "#t")] + #[serde(skip_serializing_if = "Option::is_none")] + pub hashtags: Option<Vec<String>>, #[serde(skip_serializing_if = "Option::is_none")] pub since: Option<u64>, // unix timestamp seconds #[serde(skip_serializing_if = "Option::is_none")] @@ -31,6 +34,7 @@ impl Filter { kinds: None, events: None, pubkeys: None, + hashtags: None, since: None, until: None, limit: None, diff --git a/src/filter.rs b/src/filter.rs @@ -24,6 +24,11 @@ pub fn convert_enostr_filter(filter: &enostr::Filter) -> nostrdb::Filter { nfilter.pubkeys(pubkeys.iter().map(|a| *a.bytes()).collect()); } + // #t + if let Some(ref hashtags) = filter.hashtags { + nfilter.tags(hashtags.clone(), 't'); + } + if let Some(since) = filter.since { nfilter.since(since); }