Skip to content

feat: auto-close dispute UI when order reaches terminal state #494

@Catrya

Description

@Catrya

Problem

When an order with an active dispute is resolved by the users themselves (cooperative cancellation or seller release), the dispute is correctly closed on the backend (Mostro updates the dispute event in Nostr), but the mobile app doesn't reflect this change.

The user continues seeing the dispute as "Initiated" or "In Progress" even though:

  • The order was successfully canceled/completed
  • The dispute no longer exists functionally

Root Cause

The mobile app subscribes to kind 1059 (Gift Wrap for dispute chat) but does not subscribe to kind 38386 (dispute state events). When Mostro publishes the updated dispute event with status Settled or SellerRefunded, the mobile never sees it.

Proposed Solution

Instead of adding a new subscription or new message type, the mobile should infer that a dispute is closed when its associated order reaches a terminal state.

Logic

When order.status changes to (cooperativelyCanceled | success):
→ If dispute exists with dispute.orderId == order.id (http://order.id/):
→ Mark dispute as closed/resolved in UI

Why this approach?

  1. No backend changes needed — Mostro already handles everything correctly
  2. No protocol expansion — No new Actions required
  3. Simple logic — "Order finished = dispute finished"
  4. Data already available — Mobile has dispute.orderId linking disputes to orders

Implementation hints

  • In order_notifier.dart or similar, when detecting order transition to terminal state
  • Check if there's a dispute associated with that order
  • Update the dispute status in the local state to "resolved" or equivalent
  • Update dispute_status_badge.dart to recognize settled and released statuses (currently falls back to default)

Additional context

Related PR: MostroP2P/mostro#606 (closes dispute on Nostr when seller releases)

The backend is already publishing the correct dispute status to Nostr. This issue is about the mobile correctly reflecting that state.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions