Repository navigation
feat(campaigns): moderated donor wishes wall, heart reactions & staff wish-report queue (#320) - #328
Conversation
… wish-report queue (#320)
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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
|
|
PO acceptance: merge at 7ac2a1d Independent PO flagship review (794384e5-b927-49e9-81d7-4bc68e641ecf): APPROVE (0 P0/P1/P2 findings).
|
Refs #320
Summary
Phase 2 (App) for Give v2 Sprint 5 Wave C (Gói 5b) — Moderated Donor Wishes Wall ("Tường lời chúc") and heart reactions, built on Phase 1 DB migration
DOS/DOS.Me#1888(20261202140000_give_donor_wishes_and_hearts.sql, live on Supabase Betaoyajkbadsykigtfrpdpgat161495457b430a9a497ba4d7e36d8cf76394c66b).Key Changes
apps/web/src/lib/donor-wishes.ts,apps/web/src/lib/errors.ts):listCampaignWishes,listHiddenCampaignWishes,listReportedContributionMessages), Zod validation schemas (reportWishSchema,moderateWishSchema), anonymous donor masking ("Người ủng hộ ẩn danh"), pagination & filter parsers.GIVE_*error codes (GIVE_WISH_NOT_FOUND,GIVE_STAFF_HIDE_LOCKED,WISH_HEART_MESSAGES,WISH_REPORT_MESSAGES,WISH_MODERATION_MESSAGES,wishDbErrorMessage) with zero raw Postgres error leaks./campaigns/[slug](DonorWishesWall.tsx,WishHeartButton.tsx,wish-actions.ts,page.tsx):isPublicLiveOrEnded(never queried or rendered onpublicPrelaunchorpreview).dbAs(session.accessToken)for signed-in callers (withPGRST30*fallback todbAs()) anddbAs()for guests — zerodbService()usage.tabular-nums), timestamp, heart count, and interactive heart toggle (toggle_contribution_heart; plain<a>login link for guests).report_contribution_message); campaign owners, accepted co-organizer editors (#264), and non-self moderators can hide wishes and view/restore hidden wishes vialist_hidden_campaign_wishesrespectingcan_restore(staff hides cannot be overridden by owner/editor)./admin/reports/wishes+ nav tabs on/admin/reports&/admin/reports/comments):dbAs(session.accessToken)(zerodbService()), supportingopen | resolved | dismissed | allfilters andhide/restore/dismiss_reportswith explicit notice that restoring an open-reported wish keeps open reports open until dismissed.DonateForm.tsx,pledge/PledgeForm.tsx):messagetextarea label & helper text as a public wish displayed after bank-statement matching (zero money-flow regression).Verification
pnpm format:check: PASSpnpm lint: PASSpnpm typecheck: PASSpnpm test: PASS (211/211 test files, 2,889/2,889 tests including new unit/component/action/page suites)pnpm build: PASS (Next.js production build including/admin/reports/wishes)CLEAN_PASS📌 TL;DR
This PR introduces a public "Donor Wishes Wall" on campaign pages and a corresponding admin moderation queue (
/admin/reports/wishes) for managing reported wishes. It implements strict security controls, including XSS-safe plain-text rendering, anonymous donor masking, and role-based access for hiding/restoring content.🎯 Type of Change
🔍 Changes Walkthrough
apps/web/src/app/admin/reports/comments/page.tsxapps/web/src/app/admin/reports/page.tsxapps/web/src/app/admin/reports/wishes/actions.tsmoderateReportedWishthat handles hiding, restoring, or dismissing reports on wishes. Validates input, calls themoderate_contribution_messageRPC viadbAs, and revalidates relevant paths.apps/web/src/app/admin/reports/wishes/actions.test.tsapps/web/src/app/admin/reports/wishes/page.tsxapps/web/src/app/admin/reports/wishes/page.test.tsapps/web/src/app/campaigns/[slug]/DonateForm.tsxapps/web/src/app/campaigns/[slug]/DonorWishesWall.tsxapps/web/src/app/campaigns/[slug]/DonorWishesWall.test.tsapps/web/src/app/campaigns/[slug]/page.tsxDonorWishesWallinto the campaign page. Added logic to fetch public wishes and hidden wishes (for authorized users) only when the campaign is live/ended.apps/web/src/app/campaigns/[slug]/page.test.ts📊 Architectural Flow
sequenceDiagram participant User as User (Browser) participant CampaignPage as Campaign Page (Server) participant AdminPage as Admin Reports Page (Server) participant DB as Database (Supabase) Note over User, CampaignPage: Public View (Live Campaign) User->>CampaignPage: Request /campaigns/[slug] CampaignPage->>DB: Fetch public wishes (dbAs) DB-->>CampaignPage: Wish data CampaignPage-->>User: Render DonorWishesWall (XSS-safe) opt Signed-in User with Role User->>CampaignPage: Request with show_hidden_wishes=1 CampaignPage->>DB: Check role & fetch hidden wishes DB-->>CampaignPage: Hidden wish data CampaignPage-->>User: Render Hidden Wishes Drawer end Note over User, AdminPage: Moderation Flow User->>AdminPage: Request /admin/reports/wishes AdminPage->>DB: Verify staff role (dbAs) DB-->>AdminPage: Access granted AdminPage->>DB: Fetch reported wishes DB-->>AdminPage: Report data AdminPage-->>User: Render Moderation Queue User->>AdminPage: Submit Moderation Action (Hide/Restore) AdminPage->>DB: Call moderate_contribution_message RPC DB-->>AdminPage: Success & resolved count AdminPage->>AdminPage: Revalidate paths AdminPage-->>User: Success message