Skip to content

fix(client): hide OpenDisputeForm when a dispute is already Open - #215

Closed
shinzoxD wants to merge 1 commit into
Cylo-Traders:masterfrom
shinzoxD:fix/guard-duplicate-open-dispute
Closed

fix(client): hide OpenDisputeForm when a dispute is already Open#215
shinzoxD wants to merge 1 commit into
Cylo-Traders:masterfrom
shinzoxD:fix/guard-duplicate-open-dispute

Conversation

@shinzoxD

Copy link
Copy Markdown

Summary

OpenDisputeForm no longer offers a second open-dispute action when the campaign already has an open dispute.

The form now calls useDispute(campaignId) and, when status.tag === 'Open', replaces the reason field and submit button with a short status message so users are not asked to sign a duplicate open_dispute that the contract will reject (campaign not disputable).

Closes #188

Changes

  • OpenDisputeForm checks useDispute() and hides the form when a dispute is already Open
  • Eligible wallets see: "A dispute is already open on this campaign — an admin needs to resolve it before a new one can be opened."
  • Wired the form into CampaignDetailPage so the guard is reachable from the campaign UI

Tests

  • New test in client/src/components/campaign/__tests__/OpenDisputeForm.test.tsx: given a mocked open dispute, the form (reason field + submit) does not render and the explanatory message does
  • Existing eligibility / submit / error tests still pass (8/8 in this file)
cd client && npx eslint src/components/campaign/OpenDisputeForm.tsx src/components/campaign/__tests__/OpenDisputeForm.test.tsx
cd client && npx vitest run src/components/campaign/__tests__/OpenDisputeForm.test.tsx

Repo-wide npm run lint still reports pre-existing Windows prettier/prettier Delete ␍ errors on untouched files (same as master with core.autocrlf=true). The new files lint clean.

Payout wallet

GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH

Call useDispute and replace the reason field and submit button with a short status message whenever status.tag is Open, so users are not prompted to sign a duplicate open_dispute that the contract will reject.

Closes Cylo-Traders#188
Copilot AI lite review requested due to automatic review settings August 24, 2026 17:02

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@shinzoxD

Copy link
Copy Markdown
Author

Closing as overlapping with #183 (@LamsOfJos), which already adds OpenDisputeForm for #145.

#188 (duplicate-open guard) should land on top of that form after #183 merges, not as a second copy of the component.

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.

No guard against opening a duplicate dispute on the same campaign

3 participants