Skip to content

Commit a0145b2

Browse files
grunchclaude
andcommitted
fix(listdisputes): use NOSTR_DISPUTE_EVENT_KIND for dispute filter
`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) <noreply@anthropic.com>
1 parent 76fb814 commit a0145b2

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

src/util/events.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ fn create_fake_timestamp() -> Result<Timestamp> {
1919
Ok(Timestamp::from(fake_since_time))
2020
}
2121

22-
fn create_seven_days_filter(letter: Alphabet, value: String, pubkey: PublicKey) -> Result<Filter> {
22+
fn create_seven_days_filter(
23+
letter: Alphabet,
24+
value: String,
25+
pubkey: PublicKey,
26+
event_kind: u16,
27+
) -> Result<Filter> {
2328
let since_time = chrono::Utc::now()
2429
.checked_sub_signed(chrono::Duration::days(7))
2530
.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)
3035
.limit(50)
3136
.since(timestamp)
3237
.custom_tag(SingleLetterTag::lowercase(letter), value)
33-
.kind(nostr_sdk::Kind::Custom(NOSTR_ORDER_EVENT_KIND)))
38+
.kind(nostr_sdk::Kind::Custom(event_kind)))
3439
}
3540

3641
pub fn create_filter(
@@ -39,8 +44,18 @@ pub fn create_filter(
3944
since: Option<&i64>,
4045
) -> Result<Filter> {
4146
match list_kind {
42-
ListKind::Orders => create_seven_days_filter(Alphabet::Z, "order".to_string(), pubkey),
43-
ListKind::Disputes => create_seven_days_filter(Alphabet::Z, "dispute".to_string(), pubkey),
47+
ListKind::Orders => create_seven_days_filter(
48+
Alphabet::Z,
49+
"order".to_string(),
50+
pubkey,
51+
NOSTR_ORDER_EVENT_KIND,
52+
),
53+
ListKind::Disputes => create_seven_days_filter(
54+
Alphabet::Z,
55+
"dispute".to_string(),
56+
pubkey,
57+
NOSTR_DISPUTE_EVENT_KIND,
58+
),
4459
ListKind::DirectMessagesAdmin | ListKind::DirectMessagesUser => {
4560
let fake_timestamp = create_fake_timestamp()?;
4661
Ok(Filter::new()

0 commit comments

Comments
 (0)