The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
check for notBefore
Pedro Ladeira09846989328f
diff --git a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts b/apps/web/app/(ee)/api/bounties/[bountyId]/route.tsindex aef35da2f0..918d6fc54b 100644--- a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts+++ b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts@@ -290,6 +290,7 @@ export const PATCH = withWorkspace(body: {bountyId: bounty.id,},+ notBefore: Math.floor(data.startsAt.getTime() / 1000),}),]),);diff --git a/apps/web/lib/bounty/api/upsert-draft-bounty-submissions.ts b/apps/web/lib/bounty/api/upsert-draft-bounty-submissions.tsindex 24a94d5e74..5e6d096fb0 100644--- a/apps/web/lib/bounty/api/upsert-draft-bounty-submissions.ts+++ b/apps/web/lib/bounty/api/upsert-draft-bounty-submissions.ts@@ -53,10 +53,10 @@ export function shouldUpsertDraftSubmissionsOnReopen({if (performanceScope !== "lifetime") return false;const wasExpired = previousEndsAt != null && previousEndsAt < now;- const nowActive =- startsAt <= now && (endsAt == null || endsAt > now) && !archivedAt;+ const stillExpired = endsAt != null && endsAt < now && startsAt <= now;+ const nowOrSoonActive = !archivedAt && !stillExpired;- return wasExpired && nowActive;+ return wasExpired && nowOrSoonActive;}export function planDraftBountySubmissionUpserts({diff --git a/apps/web/tests/bounties/upsert-draft-bounty-submissions.test.ts b/apps/web/tests/bounties/upsert-draft-bounty-submissions.test.tsindex 043f746867..e85f0b1901 100644--- a/apps/web/tests/bounties/upsert-draft-bounty-submissions.test.ts+++ b/apps/web/tests/bounties/upsert-draft-bounty-submissions.test.ts@@ -78,6 +78,34 @@ describe("shouldUpsertDraftSubmissionsOnReopen", () => {).toBe(true);});+ it("returns true when an expired bounty is rescheduled with a future startsAt", () => {+ expect(+ shouldUpsertDraftSubmissionsOnReopen({+ type: "performance",+ performanceScope: "lifetime",+ previousEndsAt: new Date("2025-05-01T00:00:00.000Z"),+ startsAt: new Date("2025-07-01T00:00:00.000Z"),+ endsAt: new Date("2025-12-01T00:00:00.000Z"),+ archivedAt: null,+ now: NOW,+ }),+ ).toBe(true);+ });++ it("returns false when the bounty previously had no endsAt", () => {+ expect(+ shouldUpsertDraftSubmissionsOnReopen({+ type: "performance",+ performanceScope: "lifetime",+ previousEndsAt: null,+ startsAt: new Date("2025-01-01T00:00:00.000Z"),+ endsAt: new Date("2025-12-01T00:00:00.000Z"),+ archivedAt: null,+ now: NOW,+ }),+ ).toBe(false);+ });+it("returns false for new-scope performance bounties", () => {expect(shouldUpsertDraftSubmissionsOnReopen({