-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bounty submission character limit #3049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
On the backend there was an 1000 character limit but we weren't enforcing it on the form and/or displaying it to the partners when they are submitting. This would create submission loops with no error message. This has been added now
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughA new constant Changes
Estimated code review effortπ― 1 (Trivial) | β±οΈ ~5 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touchesβ Failed checks (1 warning)
β Passed checks (2 passed)
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
π§Ή Nitpick comments (2)
apps/web/ui/partners/bounties/claim-bounty-modal.tsx (2)
588-593: Consider simplifying the onChange handler.Since the
maxLengthattribute (line 586) already prevents the textarea from accepting input beyond the limit, the length check in theonChangehandler is redundant. The browser will automatically enforcemaxLengthfor both typing and paste operations.You can simplify this to:
- onChange={(e) => { - const value = e.target.value; - if (value.length <= MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH) { - setDescription(value); - } - }} + onChange={(e) => setDescription(e.target.value)}However, keeping the explicit check provides defense-in-depth and doesn't cause any issues, so this is entirely optional.
595-601: Character counter provides helpful feedback.The live character counter successfully addresses the PR objective by showing partners the limit during submission. The implementation works correctly.
For improved clarity, consider one of these formats:
Option 1: Show current / max instead of remaining / max
<div className="mt-1 text-left"> <span className="text-xs text-neutral-500"> - {MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH - - description.length}{" "} - / {MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH} + {description.length} / {MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH} characters </span> </div>Option 2: Add "remaining" label to current format
<div className="mt-1 text-left"> <span className="text-xs text-neutral-500"> {MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH - - description.length}{" "} - / {MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH} + description.length} characters remaining </span> </div>
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (3)
apps/web/lib/actions/partners/create-bounty-submission.ts(2 hunks)apps/web/lib/zod/schemas/bounties.ts(1 hunks)apps/web/ui/partners/bounties/claim-bounty-modal.tsx(2 hunks)
π§° Additional context used
π§ Learnings (5)
π Common learnings
Learnt from: devkiran
Repo: dubinc/dub PR: 2736
File: apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx:45-56
Timestamp: 2025-08-25T17:39:38.965Z
Learning: In the bounty system, each partner can only submit to the same bounty once. This means totalSubmissions (pending + approved + rejected) equals the number of unique partners who have submitted, making UI text like "X of Y partners completed" accurate when using totalSubmissions.
Learnt from: devkiran
Repo: dubinc/dub PR: 2833
File: apps/web/lib/actions/partners/approve-bounty-submission.ts:53-61
Timestamp: 2025-09-12T17:31:10.548Z
Learning: In approve-bounty-submission.ts, the logic `bounty.rewardAmount ?? rewardAmount` is intentional. Bounties with preset reward amounts should use those fixed amounts, and the rewardAmount override parameter is only used when bounty.rewardAmount is null/undefined (for custom reward bounties). This follows the design pattern where bounties are either "flat rate" (fixed amount) or "custom" (variable amount set during approval).
π Learning: 2025-09-12T17:31:10.548Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2833
File: apps/web/lib/actions/partners/approve-bounty-submission.ts:53-61
Timestamp: 2025-09-12T17:31:10.548Z
Learning: In approve-bounty-submission.ts, the logic `bounty.rewardAmount ?? rewardAmount` is intentional. Bounties with preset reward amounts should use those fixed amounts, and the rewardAmount override parameter is only used when bounty.rewardAmount is null/undefined (for custom reward bounties). This follows the design pattern where bounties are either "flat rate" (fixed amount) or "custom" (variable amount set during approval).
Applied to files:
apps/web/lib/zod/schemas/bounties.tsapps/web/lib/actions/partners/create-bounty-submission.tsapps/web/ui/partners/bounties/claim-bounty-modal.tsx
π Learning: 2025-08-26T14:32:33.851Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2736
File: apps/web/lib/actions/partners/create-bounty-submission.ts:105-112
Timestamp: 2025-08-26T14:32:33.851Z
Learning: Non-performance bounties are required to have submissionRequirements. In create-bounty-submission.ts, it's appropriate to let the parsing fail if submissionRequirements is null for non-performance bounties, as this indicates a data integrity issue that should be caught.
Applied to files:
apps/web/lib/zod/schemas/bounties.tsapps/web/lib/actions/partners/create-bounty-submission.tsapps/web/ui/partners/bounties/claim-bounty-modal.tsx
π Learning: 2025-08-25T17:39:38.965Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2736
File: apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx:45-56
Timestamp: 2025-08-25T17:39:38.965Z
Learning: In the bounty system, each partner can only submit to the same bounty once. This means totalSubmissions (pending + approved + rejected) equals the number of unique partners who have submitted, making UI text like "X of Y partners completed" accurate when using totalSubmissions.
Applied to files:
apps/web/lib/zod/schemas/bounties.tsapps/web/ui/partners/bounties/claim-bounty-modal.tsx
π Learning: 2025-08-26T14:20:23.943Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2736
File: apps/web/app/api/workspaces/[idOrSlug]/notification-preferences/route.ts:13-14
Timestamp: 2025-08-26T14:20:23.943Z
Learning: The updateNotificationPreference action in apps/web/lib/actions/update-notification-preference.ts already handles all notification preference types dynamically, including newBountySubmitted, through its schema validation using the notificationTypes enum and Prisma's dynamic field update pattern.
Applied to files:
apps/web/lib/actions/partners/create-bounty-submission.ts
𧬠Code graph analysis (2)
apps/web/lib/actions/partners/create-bounty-submission.ts (1)
apps/web/lib/zod/schemas/bounties.ts (1)
MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH(23-23)
apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1)
apps/web/lib/zod/schemas/bounties.ts (1)
MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH(23-23)
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
π Additional comments (3)
apps/web/lib/zod/schemas/bounties.ts (1)
23-23: LGTM! Constant extraction improves maintainability.The new constant is well-placed alongside similar constants and provides a single source of truth for the description character limit across the codebase.
apps/web/lib/actions/partners/create-bounty-submission.ts (1)
8-8: LGTM! Backend validation now uses the centralized constant.The schema correctly imports and applies the constant, ensuring consistent validation with the frontend. This prevents the submission loop issue described in the PR objectives.
Also applies to: 31-35
apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1)
586-586: LGTM! Character limit enforcement added to textarea.The
maxLengthattribute correctly applies the constant, providing immediate feedback by preventing users from exceeding the limit during input.
On the backend there was an 1000 character limit but we weren't enforcing it on the form and/or displaying it to the partners when they are submitting. This would create submission loops with no error message.
Current

Updated

Summary by CodeRabbit