Skip to content

feat(#280): confirm before opening a dispute - #296

Merged
Catrya merged 2 commits into
MostroP2P:mainfrom
codaMW:feat/280-dispute-confirmation
Aug 10, 2026
Merged

feat(#280): confirm before opening a dispute#296
Catrya merged 2 commits into
MostroP2P:mainfrom
codaMW:feat/280-dispute-confirmation

Conversation

@codaMW

@codaMW codaMW commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Closes #280.

Problem

The "Open dispute" button in the trade detail screen called disputes_api.openDispute directly with no confirmation. An accidental tap immediately opened a dispute with the daemon an action that can't be undone and escalates the trade to an admin. The other two destructive actions in the same row already confirm: Cancel shows an AlertDialog, and Release has a dedicated release_confirmation_dialog.dart.

Fix

Add a dispute confirmation dialog following the release-confirmation pattern:

  • New dispute_confirmation_dialog.dart showDisputeConfirmationDialog(context) returning bool?, mirroring showReleaseConfirmationDialog. Styled with the destructiveRed accent and a gavel icon to signal a serious, irreversible escalation.
  • _openDispute now shows the dialog first and aborts on cancel (throw const MostroActionAborted()), exactly as _releaseOrder does so the confirmation gates the daemon call.
  • Localized openDisputeTitle + openDisputeConfirmation added to all 5 .arb files.

Testing

Three widget tests (dispute_confirmation_dialog_test.dart): renders the title/body/Yes/No, tapping Yes resolves true, tapping No resolves false. Also confirmed visually on Linux desktop (gavel icon, destructive-red confirm, correct strings, both buttons dismiss). flutter analyze clean.
Screenshot 2026-08-10 061646

Summary by CodeRabbit

  • New Features

    • Added a confirmation dialog before opening a trade dispute.
    • Clearly warns that opening a dispute is irreversible.
    • Users can confirm to proceed or cancel without opening the dispute.
    • Added localized dialog text in English, German, Spanish, French, and Italian.
  • Bug Fixes

    • Prevented disputes from being opened accidentally when the confirmation is dismissed or declined.

The "Open dispute" button called disputes_api.openDispute directly with no
confirmation, so an accidental tap immediately escalated the trade to an admin —
an action that can't be undone. The sibling destructive actions in the same row
(Cancel, Release) already confirm first.

Adds a dispute confirmation dialog following the release-confirmation pattern
(dedicated widget + Yes/No + localized strings in the 5 .arb files), styled with
the destructive-red accent to signal weight. _openDispute now shows it and
aborts on cancel, mirroring _releaseOrder.

Tests: three widget tests assert the dialog renders (title, body, Yes/No) and
that Yes resolves true / No resolves false. flutter analyze clean.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@codaMW, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b0efbfa-4010-4124-ba86-8253381fcf89

📥 Commits

Reviewing files that changed from the base of the PR and between dd3c540 and f0a46c8.

📒 Files selected for processing (1)
  • test/features/trades/trade_detail_screen_test.dart

Walkthrough

The trade detail screen now requests confirmation before opening a dispute. A reusable localized dialog displays the warning and returns the selected action. Cancellation aborts the operation. Widget tests cover content and button results.

Changes

Dispute confirmation

Layer / File(s) Summary
Confirmation dialog and localized content
lib/features/trades/widgets/dispute_confirmation_dialog.dart, lib/l10n/app_*.arb, test/features/trades/widgets/dispute_confirmation_dialog_test.dart
Adds a themed dialog with localized warning text, Yes/No actions, and widget tests for rendering and return values.
Dispute-opening integration
lib/features/trades/screens/trade_detail_screen.dart
Shows the confirmation dialog before calling the dispute API. Cancelled confirmation throws MostroActionAborted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: grunch, andreadiazcorreia

Poem

A rabbit taps the dispute gate,
“Confirm,” before we change the state.
The warning blooms in every tongue,
No stops the path; Yes sends it on.
Tests hop neatly, green and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the confirmation step added before opening a dispute.
Linked Issues check ✅ Passed The changes satisfy issue #280 by adding a dedicated Yes/No confirmation dialog, blocking cancellation, and localizing the required strings.
Out of Scope Changes check ✅ Passed The code, localization, and widget tests directly support the linked issue and contain no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ridge-failure test

The new confirmation dialog gates _openDispute, so the existing secondary-action
test must tap Yes before the flow reaches disputes_api.openDispute. Mirrors the
release and cancel confirmation steps in the sibling tests.
@codaMW
codaMW requested a review from grunch August 10, 2026 06:39

@ermeme ermeme Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head f0a46c8. The dispute action is now gated before the daemon call, cancel/dismiss paths correctly abort via MostroActionAborted, and the new strings are present across all five ARB locales with parity. CI is green for Flutter analyze/tests, Rust, and web smoke. No blockers found.

@Catrya Catrya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@Catrya
Catrya merged commit 9ff05a5 into MostroP2P:main Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add confirmation dialog before opening a dispute

2 participants