The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Keep archived submitted bounties visible and clarify partner eligibility.
Kiran Ke1f05474e093
diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/[bountyId]/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/[bountyId]/route.tsindex 59f4d90137..f050307478 100644--- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/[bountyId]/route.ts+++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/[bountyId]/route.ts@@ -38,7 +38,7 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {});const bounty = await getBountyOrThrow({- programId,+ programId: program.id,bountyId,include: {workflow: {diff --git a/apps/web/lib/bounty/api/bounty-availability.ts b/apps/web/lib/bounty/api/bounty-availability.tsindex d358b0bc0c..d81345b8d7 100644--- a/apps/web/lib/bounty/api/bounty-availability.ts+++ b/apps/web/lib/bounty/api/bounty-availability.ts@@ -67,7 +67,7 @@ type PartnerBountyEligibilityInput = {program: Pick<Program, "defaultGroupId">;bounty: Pick<Bounty,- "startsAt" | "endsAt" | "endsAfterDays" | "startMode" | "archivedAt"+ "id" | "startsAt" | "endsAt" | "endsAfterDays" | "startMode" | "archivedAt"> & {groups: Pick<BountyGroup, "groupId">[];};@@ -92,6 +92,9 @@ export function isPartnerEligibleForBounty({const partnerGroupId = programEnrollment.groupId || program.defaultGroupId;if (bountyGroupIds.length > 0 && !bountyGroupIds.includes(partnerGroupId)) {+ console.log(+ `Partner doesn't belong to any of the bounty's ${bounty.id} groups.`,+ );return false;}@@ -102,7 +105,13 @@ export function isPartnerEligibleForBounty({});// If the bounty is not in the active period, it is not visible- if (!isBountyStarted(startsAt) || isBountyExpired(endsAt)) {+ if (!isBountyStarted(startsAt)) {+ console.log(`Bounty ${bounty.id} is not started.`);+ return false;+ }++ if (isBountyExpired(endsAt)) {+ console.log(`Bounty ${bounty.id} is expired.`);return false;}diff --git a/apps/web/lib/bounty/api/create-bounty-submission.ts b/apps/web/lib/bounty/api/create-bounty-submission.tsindex 94c65a7dff..68915130e8 100644--- a/apps/web/lib/bounty/api/create-bounty-submission.ts+++ b/apps/web/lib/bounty/api/create-bounty-submission.ts@@ -242,7 +242,8 @@ export class BountySubmissionHandler {) {throw new DubApiError({code: "forbidden",- message: "You are not allowed to submit a bounty for this program.",+ message:+ "You are not allowed to submit this bounty. Please contact the program if you think this is an error.",});}diff --git a/apps/web/lib/bounty/api/get-bounties-for-partner.ts b/apps/web/lib/bounty/api/get-bounties-for-partner.tsindex e846f401ef..93d129f239 100644--- a/apps/web/lib/bounty/api/get-bounties-for-partner.ts+++ b/apps/web/lib/bounty/api/get-bounties-for-partner.ts@@ -34,41 +34,45 @@ export async function getBountiesForPartner({const bounties = await prisma.bounty.findMany({where: {programId: program.id,- archivedAt: null,OR: [- // Relative bounties start when a partner joins (no startsAt filter).{- startMode: "relative",- },-- // Absolute bounties must have started and not expired.- {- startMode: "absolute",- startsAt: {- lt: now,- },+ archivedAt: null,+ ...buildBountyEligibilityWhere(partnerGroupId),OR: [+ // Relative bounties start when a partner joins (no startsAt filter).{- endsAt: null,+ startMode: "relative",},++ // Absolute bounties must have started and not expired.{- endsAt: {- gt: now,+ startMode: "absolute",+ startsAt: {+ lt: now,},+ OR: [+ {+ endsAt: null,+ },+ {+ endsAt: {+ gt: now,+ },+ },+ ],},- ],- },- // Bounties the partner has a submission on stay visible- {- submissions: {- some: {- partnerId,+ // Bounties the partner has a submission on stay visible+ {+ submissions: {+ some: {+ partnerId,+ },+ },},- },+ ],},],- ...buildBountyEligibilityWhere(partnerGroupId),},include: {workflow: {diff --git a/apps/web/lib/bounty/api/get-bounty-or-throw.ts b/apps/web/lib/bounty/api/get-bounty-or-throw.tsindex 8d310d99b2..fdc62924fe 100644--- a/apps/web/lib/bounty/api/get-bounty-or-throw.ts+++ b/apps/web/lib/bounty/api/get-bounty-or-throw.ts@@ -25,14 +25,14 @@ export async function getBountyOrThrow<T extends Prisma.BountyInclude = {}>({if (!bounty) {throw new DubApiError({code: "not_found",- message: `Bounty ${bountyId} not found.`,+ message: `Bounty ${bountyId} not founde.`,});}if (bounty.programId !== programId) {throw new DubApiError({code: "not_found",- message: `Bounty ${bountyId} not found.`,+ message: `Bounty ${bountyId} not foundee.`,});}