Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix reject bounty submission action (#3057)

Kiran K84c16551c755
diff --git a/apps/web/lib/zod/schemas/bounties.ts b/apps/web/lib/zod/schemas/bounties.ts
index c4158f12dd..9423298390 100644
--- a/apps/web/lib/zod/schemas/bounties.ts
+++ b/apps/web/lib/zod/schemas/bounties.ts
@@ -22,6 +22,8 @@ export const MAX_SUBMISSION_URLS = 20;
export const MAX_BOUNTY_SUBMISSION_DESCRIPTION_LENGTH = 1000;
+export const MAX_BOUNTY_SUBMISSION_REJECTION_NOTE_LENGTH = 5000;
+
export const REJECT_BOUNTY_SUBMISSION_REASONS = {
invalidProof: "Invalid proof",
duplicateSubmission: "Duplicate submission",
@@ -163,7 +165,11 @@ export const rejectBountySubmissionSchema = z.object({
workspaceId: z.string(),
submissionId: z.string(),
rejectionReason: z.nativeEnum(BountySubmissionRejectionReason),
- rejectionNote: z.string().trim().max(500).optional(),
+ rejectionNote: z
+ .string()
+ .trim()
+ .max(MAX_BOUNTY_SUBMISSION_REJECTION_NOTE_LENGTH)
+ .optional(),
});
export const getBountySubmissionsQuerySchema = z
diff --git a/apps/web/ui/partners/reject-bounty-submission-modal.tsx b/apps/web/ui/partners/reject-bounty-submission-modal.tsx
index 8c18abdb66..ba3266ed56 100644
--- a/apps/web/ui/partners/reject-bounty-submission-modal.tsx
+++ b/apps/web/ui/partners/reject-bounty-submission-modal.tsx
@@ -4,6 +4,7 @@ import useBounty from "@/lib/swr/use-bounty";
import useWorkspace from "@/lib/swr/use-workspace";
import { BountySubmissionProps } from "@/lib/types";
import {
+ MAX_BOUNTY_SUBMISSION_REJECTION_NOTE_LENGTH,
REJECT_BOUNTY_SUBMISSION_REASONS,
rejectBountySubmissionSchema,
} from "@/lib/zod/schemas/bounties";
@@ -138,18 +139,19 @@ const RejectBountySubmissionModal = ({
</span>
</label>
<span className="text-xs text-neutral-400">
- {watch("rejectionNote")?.length || 0}/5,000
+ {watch("rejectionNote")?.length || 0}/
+ {MAX_BOUNTY_SUBMISSION_REJECTION_NOTE_LENGTH}
</span>
</div>
<div className="mt-2">
<textarea
id="rejectionNote"
{...register("rejectionNote", {
- maxLength: 5000,
+ maxLength: MAX_BOUNTY_SUBMISSION_REJECTION_NOTE_LENGTH,
setValueAs: (value) => (value === "" ? undefined : value),
})}
rows={3}
- maxLength={5000}
+ maxLength={MAX_BOUNTY_SUBMISSION_REJECTION_NOTE_LENGTH}
className={cn(
"block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
errors.rejectionNote &&