From a0145b2420cfe2fb362df2526a2e9da5c7f10fdd Mon Sep 17 00:00:00 2001 From: grunch Date: Wed, 13 May 2026 17:25:02 -0300 Subject: [PATCH] fix(listdisputes): use NOSTR_DISPUTE_EVENT_KIND for dispute filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `listdisputes` returned no results because `create_seven_days_filter` hardcoded `NOSTR_ORDER_EVENT_KIND` (38383) for every list kind. Dispute events are published by mostrod under `NOSTR_DISPUTE_EVENT_KIND` (38386), so the filter never matched and the public dispute queue always rendered as empty even when disputes existed on the relays. Pass the event kind into `create_seven_days_filter` and select the right constant per `ListKind` (orders → 38383, disputes → 38386). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/util/events.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/util/events.rs b/src/util/events.rs index d6f0006..d132428 100644 --- a/src/util/events.rs +++ b/src/util/events.rs @@ -19,7 +19,12 @@ fn create_fake_timestamp() -> Result { Ok(Timestamp::from(fake_since_time)) } -fn create_seven_days_filter(letter: Alphabet, value: String, pubkey: PublicKey) -> Result { +fn create_seven_days_filter( + letter: Alphabet, + value: String, + pubkey: PublicKey, + event_kind: u16, +) -> Result { let since_time = chrono::Utc::now() .checked_sub_signed(chrono::Duration::days(7)) .ok_or(anyhow::anyhow!("Failed to get since days ago"))? @@ -30,7 +35,7 @@ fn create_seven_days_filter(letter: Alphabet, value: String, pubkey: PublicKey) .limit(50) .since(timestamp) .custom_tag(SingleLetterTag::lowercase(letter), value) - .kind(nostr_sdk::Kind::Custom(NOSTR_ORDER_EVENT_KIND))) + .kind(nostr_sdk::Kind::Custom(event_kind))) } pub fn create_filter( @@ -39,8 +44,18 @@ pub fn create_filter( since: Option<&i64>, ) -> Result { match list_kind { - ListKind::Orders => create_seven_days_filter(Alphabet::Z, "order".to_string(), pubkey), - ListKind::Disputes => create_seven_days_filter(Alphabet::Z, "dispute".to_string(), pubkey), + ListKind::Orders => create_seven_days_filter( + Alphabet::Z, + "order".to_string(), + pubkey, + NOSTR_ORDER_EVENT_KIND, + ), + ListKind::Disputes => create_seven_days_filter( + Alphabet::Z, + "dispute".to_string(), + pubkey, + NOSTR_DISPUTE_EVENT_KIND, + ), ListKind::DirectMessagesAdmin | ListKind::DirectMessagesUser => { let fake_timestamp = create_fake_timestamp()?; Ok(Filter::new()