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.

Misc. bounties fixes

Tim Wilson54bba4828cda
diff --git a/apps/web/app/(ee)/api/cron/payouts/create-payout.ts b/apps/web/app/(ee)/api/cron/payouts/create-payout.ts
index 61e8f4f85f..fd640b9937 100644
--- a/apps/web/app/(ee)/api/cron/payouts/create-payout.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/create-payout.ts
@@ -62,7 +62,7 @@ export const createPayout = async ({
const [commissions, clawbacks] = await Promise.all([
// Find all pending commissions
- // We only process commissions that were created before the holding period
+ // We only process commissions that are custom or were created before the holding period
prisma.commission.findMany({
where: {
earnings: {
@@ -70,9 +70,18 @@ export const createPayout = async ({
},
...commonWhere,
...(holdingPeriodDays > 0 && {
- createdAt: {
- lt: new Date(Date.now() - holdingPeriodDays * 24 * 60 * 60 * 1000),
- },
+ OR: [
+ {
+ createdAt: {
+ lt: new Date(
+ Date.now() - holdingPeriodDays * 24 * 60 * 60 * 1000,
+ ),
+ },
+ },
+ {
+ type: "custom", // Custom commissions skip the holding period
+ },
+ ],
}),
},
select: {
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submission-details-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submission-details-sheet.tsx
index bf690f40af..4e184025eb 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submission-details-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submission-details-sheet.tsx
@@ -45,7 +45,7 @@ function BountySubmissionDetailsSheetContent({
onSuccess: async () => {
toast.success("Bounty submission approved successfully!");
setIsOpen(false);
- await mutatePrefix(`/api/bounties/${bounty?.id}/submissions`);
+ await mutatePrefix("/api/bounties");
},
onError({ error }) {
toast.error(error.serverError);
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
index 190de13994..611b624dc0 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
@@ -426,7 +426,7 @@ function RowMenuButton({
onSuccess: async () => {
toast.success("Bounty submission approved successfully!");
setIsOpen(false);
- await mutatePrefix(`/api/bounties/${bountyId}/submissions`);
+ await mutatePrefix("/api/bounties");
},
onError({ error }) {
toast.error(error.serverError);
diff --git a/apps/web/lib/actions/partners/create-bounty-submission.ts b/apps/web/lib/actions/partners/create-bounty-submission.ts
index a14d392dbf..4fce606383 100644
--- a/apps/web/lib/actions/partners/create-bounty-submission.ts
+++ b/apps/web/lib/actions/partners/create-bounty-submission.ts
@@ -104,7 +104,7 @@ export const createBountySubmissionAction = authPartnerActionClient
// Validate the submission requirements
const submissionRequirements = submissionRequirementsSchema.parse(
- bounty.submissionRequirements,
+ bounty.submissionRequirements || [],
);
const requireImage = submissionRequirements.includes("image");
diff --git a/apps/web/ui/partners/bounties/claim-bounty-modal.tsx b/apps/web/ui/partners/bounties/claim-bounty-modal.tsx
index bbc544f786..32552b4b7f 100644
--- a/apps/web/ui/partners/bounties/claim-bounty-modal.tsx
+++ b/apps/web/ui/partners/bounties/claim-bounty-modal.tsx
@@ -444,7 +444,12 @@ function ClaimBountyModalContent({
variant="primary"
text={isFormOpen ? "Submit proof" : "Claim bounty"}
className="grow rounded-lg"
- onClick={isFormOpen ? undefined : () => setIsFormOpen(true)}
+ onClick={
+ isFormOpen
+ ? undefined
+ : // Delay open to prevent also submitting the form
+ () => setTimeout(() => setIsFormOpen(true), 100)
+ }
loading={isPending}
disabled={
isFormOpen &&