Repository navigation
Editor account section and submit guard for back campaigns (#85) - #90
Merged
Merged
Conversation
Back campaigns now need a usable receiving account before review, approval and live (DOS/DOS.Me#1549), because their backers pay into it once the campaign succeeds. The editor shows the receiving account section and blocks "Gửi duyệt" for back campaigns as for give ones, and submitForReview checks the account for both types. Back campaigns have no account swap, so a blocked back campaign whose account already recorded money is told to contact Give instead; swap requests are read for give campaigns only. A back campaign sent back for changes may release an account that saw no transaction, matching the database. Wording no longer limits these rules to charity campaigns, and the moderators' waiting queue shows each campaign's type. Refs #85 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Contributor
Author
|
PO acceptance: merge at 573b41c. CI green, DOS Code Review CLEAN_PASS, Vitest 895. DB part DOS/DOS.Me#1549 merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #85
Why
A back campaign's backers pay the creator's own bank account by VietQR once the campaign succeeds, so a back campaign must not be submitted, approved or go live without a usable receiving account. The database rule is DOS/DOS.Me#1549 (migration
20261106100000); this PR is the app side.What
/me/campaigns/[id]: the "Tài khoản nhận tiền" section (M1 editor: bind the receiving account in the campaign editor and require it before review #32's picker, bound account, release) and the "Gửi duyệt" guard now show for back campaigns too. The section's intro says when backers pay (after success).submitForReviewchecks the account for both types beforetransition_campaign(which re-checks).lib/campaign-account.ts:checkSubmitAccountandloadEditorAccountstake the campaign type; swap requests are read for give only;submitUnusableAccount/submitAccountProblemtakecanSwapso a back campaign whose unusable account recorded money is told to contact Give (no swap exists for back, Replace a disabled receiving account on a live give campaign #55 is give-only).canAskRelease: a back campaign inchanges_requestedmay release (matches the DB change, Recover a give campaign whose receiving account becomes unusable after approval #64 recovery for back).Tests
changes_requested).turbo typecheck lintgreen, Prettier clean.Merge after (or with) DOS/DOS.Me#1549.
🤖 Generated with Claude Code
📌 TL;DR
Extends the receiving account validation and release logic to support "back" (reward-based) campaigns, ensuring they require a verified account before review and allowing account releases when changes are requested. Updates UI copy and error messages to distinguish between charity and reward-based campaigns, directing the latter to contact support for account swaps.
🎯 Type of Change
🔍 Changes Walkthrough
apps/web/src/app/admin/page.tsxTypeBadgeto distinguish campaign types.apps/web/src/app/me/accounts/actions.test.tsreleaseAccountnow succeeds for "back" campaigns inchanges_requestedstatus.apps/web/src/app/me/accounts/page.tsxapps/web/src/app/me/campaigns/[id]/page.tsxapps/web/src/app/me/campaigns/actions.test.tssubmitForReviewblocks "back" campaigns without a valid account and handles unusable accounts correctly.apps/web/src/app/me/campaigns/actions.tssubmitForReviewto enforce account validation for all campaign types, passing the campaign type to the validation logic.apps/web/src/lib/campaign-account.test.tsloadEditorAccountsandsubmitAccountProblemto cover "back" campaign scenarios, including the absence of swap requests.apps/web/src/lib/campaign-account.tsloadEditorAccounts,checkSubmitAccount, andsubmitAccountProblemto accept atypeparameter. Logic now prevents swap requests for "back" campaigns and generates appropriate error messages.apps/web/src/lib/campaigns.tsapps/web/src/lib/errors.tsapps/web/src/lib/receiving-accounts.test.tscanAskReleasereturnstruefor "back" campaigns inchanges_requestedstatus.apps/web/src/lib/receiving-accounts.tscanAskReleaseto allow account releases for any campaign type (including "back") when the status ischanges_requested.📊 Architectural Flow
flowchart TD A[Organizer Submits Campaign] --> B{Check Campaign Type} B -->|Give| C[Validate Account & Check Swap Eligibility] B -->|Back| D[Validate Account & Disable Swap] C --> E{Account Usable?} D --> E E -->|No| F[Block Submission] F --> G{Has Transactions?} G -->|Yes & Give| H[Direct to Swap Request] G -->|Yes & Back| I[Direct to Contact Support] G -->|No| J[Direct to Release & Rebind] E -->|Yes| K[Allow Submission to Review] L[Organizer Requests Release] --> M{Status is changes_requested?} M -->|Yes| N{Type is defined?} N -->|Yes| O[Allow Release] N -->|No| P[Refuse Release] M -->|No| Q[Check Standard Release Rules]