The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix generateBountyName
Steven Teyfb2cacbcce88
diff --git a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts b/apps/web/app/(ee)/api/bounties/[bountyId]/route.tsindex 1d6813a93b..cf07199284 100644--- a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts+++ b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts@@ -1,4 +1,5 @@import { recordAuditLog } from "@/lib/api/audit-logs/record-audit-log";+import { generateBountyName } from "@/lib/api/bounties/generate-bounty-name";import { getBountyWithDetails } from "@/lib/api/bounties/get-bounty-with-details";import { DubApiError } from "@/lib/api/errors";import { throwIfInvalidGroupIds } from "@/lib/api/groups/throw-if-invalid-group-ids";@@ -101,7 +102,13 @@ export const PATCH = withWorkspace(id: bounty.id,},data: {- name: name ?? undefined,+ name:+ bounty.type === "performance" && rewardAmount+ ? generateBountyName({+ rewardAmount,+ condition: performanceCondition,+ })+ : name ?? undefined,description,startsAt: startsAt!, // Can remove the ! when we're on a newer TS version (currently 5.4.4)endsAt,diff --git a/apps/web/lib/api/bounties/generate-bounty-name.ts b/apps/web/lib/api/bounties/generate-bounty-name.tsindex e22b75ee81..83b3ed3cbf 100644--- a/apps/web/lib/api/bounties/generate-bounty-name.ts+++ b/apps/web/lib/api/bounties/generate-bounty-name.ts@@ -11,14 +11,16 @@ export const generateBountyName = ({condition?: WorkflowCondition | null;}) => {if (!condition) {- return `Earn ${currencyFormatter(rewardAmount / 100)}`;+ return `Earn ${currencyFormatter(rewardAmount / 100, { trailingZeroDisplay: "stripIfInteger" })}`;}const isCurrency = isCurrencyAttribute(condition.attribute);- const rewardAmountFormatted = currencyFormatter(rewardAmount / 100);+ const rewardAmountFormatted = currencyFormatter(rewardAmount / 100, {+ trailingZeroDisplay: "stripIfInteger",+ });const attributeLabel = WORKFLOW_ATTRIBUTE_LABELS[condition.attribute];const valueFormatted = isCurrency- ? `${currencyFormatter(condition.value / 100)} in`+ ? `${currencyFormatter(condition.value / 100, { trailingZeroDisplay: "stripIfInteger" })} in`: `${nFormatter(condition.value, { full: true })}`;return `Earn ${rewardAmountFormatted} after generating ${valueFormatted} ${attributeLabel}`;