Skip to content

Reject grant applications without cooldown#1399

Open
RevTpark wants to merge 1 commit into
mainfrom
feat/reject-wo-cooldown
Open

Reject grant applications without cooldown#1399
RevTpark wants to merge 1 commit into
mainfrom
feat/reject-wo-cooldown

Conversation

@RevTpark
Copy link
Copy Markdown
Collaborator

@RevTpark RevTpark commented Jun 1, 2026

What does this PR do?

  • Adds a field to reject grant applications without the mandatory cooldown for the applicant

Where should the reviewer start?

How should this be manually tested?

Any background context you want to provide?

What are the relevant issues?

Screenshots (if appropriate)

Summary by CodeRabbit

  • New Features
    • Added ability to skip the 30-day cooldown period when rejecting grant applications. A new toggle has been added to the rejection confirmation dialog, allowing administrators to choose whether the standard cooldown applies to rejected applications.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
earn Ready Ready Preview Jun 1, 2026 4:03pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f10e7ac-15b6-4f70-ba63-c5fc557b96e2

📥 Commits

Reviewing files that changed from the base of the PR and between 88578b5 and 7bbde09.

📒 Files selected for processing (7)
  • prisma/schema.prisma
  • src/app/api/grant-application/create/route.ts
  • src/features/grants/hooks/useApplicationState.ts
  • src/features/sponsor-dashboard/components/ApplicationsTab.tsx
  • src/features/sponsor-dashboard/components/GrantApplications/Modals/RejectModal.tsx
  • src/features/sponsor-dashboard/mutations/useRejectGrantApplications.ts
  • src/pages/api/sponsor-dashboard/grants/update-application-status.ts

Walkthrough

The PR adds an optional feature to skip the 30-day cooldown when rejecting grant applications. It introduces a new isCooldownSkipped boolean field to the database, extends the rejection API to accept and persist this flag, updates the rejection modal UI with a toggle switch, wires the flag through mutations and callbacks, and gates the cooldown state logic on the new flag.

Changes

Skip-cooldown feature for rejected grant applications

Layer / File(s) Summary
Database schema: isCooldownSkipped field
prisma/schema.prisma
Add isCooldownSkipped boolean field with default false to GrantApplication model.
API handler: validation and rejection update
src/pages/api/sponsor-dashboard/grants/update-application-status.ts
Extend UpdateGrantApplicationSchema with optional skipCooldown parameter, extract it from request, and set isCooldownSkipped on rejected applications when skipCooldown is truthy; update type annotations.
API read-side: filter rejected applications by cooldown skip
src/app/api/grant-application/create/route.ts
Filter rejected applications to exclude those with isCooldownSkipped set, ensuring the cooldown window only applies to applications not opted-out.
Reject modal: UI and state for cooldown skip toggle
src/features/sponsor-dashboard/components/GrantApplications/Modals/RejectModal.tsx
Add Switch import, update onRejectGrant prop contract, introduce skipCooldown state with reset logic on modal reopen and note discard, add "Apply 30-day cooldown" toggle switch in UI, refactor reject button text to derived variables for loading state.
Data flow: callback and mutation wiring
src/features/sponsor-dashboard/components/ApplicationsTab.tsx, src/features/sponsor-dashboard/mutations/useRejectGrantApplications.ts
Wire skipCooldown through ApplicationsTab callback and useRejectGrantApplications mutation: add skipCooldown to mutation input type, destructure in mutation function, conditionally include in API payload, and update optimistic cache with isCooldownSkipped value.
Application state: gate COOLDOWN on isCooldownSkipped flag
src/features/grants/hooks/useApplicationState.ts
Update useApplicationState to resolve COOLDOWN state only when both !application.isCooldownSkipped and isGrantApplicationInCooldown() are true, otherwise fall back to ALLOW NEW.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • SuperteamDAO/earn#1372: Both PRs modify the rejected-grant 30‑day cooldown logic in src/app/api/grant-application/create/route.ts and src/features/grants/hooks/useApplicationState.ts (main PR adds isCooldownSkipped gating around the same cooldown window, while retrieved PR implements the cooldown window itself).

Suggested reviewers

  • a20hek

Poem

🐰 A cooldown so swift, now sponsors can skip,
With a toggle and a flip, grant rejects take a trip,
The database remembers, the state bends to will,
When thirty days seem too long, the feature does thrill! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding functionality to reject grant applications without triggering the mandatory 30-day cooldown period.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reject-wo-cooldown

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 and usage tips.

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.

1 participant