The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix executeAwardBountyAction
Steven Teyef0ce6b7b2e8
diff --git a/apps/web/app/(ee)/api/cron/bounties/create-draft-submissions/route.ts b/apps/web/app/(ee)/api/cron/bounties/create-draft-submissions/route.tsindex 34e145939b..724e442751 100644--- a/apps/web/app/(ee)/api/cron/bounties/create-draft-submissions/route.ts+++ b/apps/web/app/(ee)/api/cron/bounties/create-draft-submissions/route.ts@@ -20,8 +20,8 @@ const schema = z.object({const MAX_PAGE_SIZE = 100;-// POST /api/cron/bounties/create-submissions-// Create draft bounty submissions for performance bounties for partners+// POST /api/cron/bounties/create-draft-submissions+// Create draft bounty submissions for performance bounties with lifetime performance scopeexport async function POST(req: Request) {try {const rawBody = await req.text();diff --git a/apps/web/lib/api/workflows/execute-award-bounty-action.ts b/apps/web/lib/api/workflows/execute-award-bounty-action.tsindex c688dfcb2b..37a61960bb 100644--- a/apps/web/lib/api/workflows/execute-award-bounty-action.ts+++ b/apps/web/lib/api/workflows/execute-award-bounty-action.ts@@ -40,6 +40,11 @@ export const executeAwardBountyAction = async ({include: {program: true,groups: true,+ submissions: {+ where: {+ partnerId,+ },+ },},});@@ -71,7 +76,7 @@ export const executeAwardBountyAction = async ({return;}- const { groups } = bounty;+ const { groups, submissions } = bounty;// If the bounty is part of a group, check if the partner is in the groupif (groups.length > 0) {@@ -85,6 +90,14 @@ export const executeAwardBountyAction = async ({}}+ // Check if the partner's submission has already been approved+ if (submissions.length > 0 && submissions[0].status === "approved") {+ console.log(+ `Partner ${partnerId} has already been awarded this bounty (bountyId: ${bounty.id}, submissionId: ${submissions[0].id}).`,+ );+ return;+ }+console.log(`Partner is eligible for bounty ${bounty.id}, executing workflow ${bounty.workflowId}...`,);diff --git a/apps/web/ui/partners/partner-profile-sheet.tsx b/apps/web/ui/partners/partner-profile-sheet.tsxdeleted file mode 100644index 349fa8f21e..0000000000--- a/apps/web/ui/partners/partner-profile-sheet.tsx+++ /dev/null@@ -1,142 +0,0 @@-import { EnrolledPartnerProps } from "@/lib/types";-import { X } from "@/ui/shared/icons";-import { Button, Sheet, useRouterStuff } from "@dub/ui";-import { COUNTRIES, OG_AVATAR_URL } from "@dub/utils";-import { Dispatch, SetStateAction, useMemo, useState } from "react";-import { OnlinePresenceSummary } from "./online-presence-summary";--type PartnerProfileSheetProps = {- partner: EnrolledPartnerProps;- setIsOpen: Dispatch<SetStateAction<boolean>>;-};--function PartnerProfileSheetContent({- partner,- setIsOpen,-}: PartnerProfileSheetProps) {- const basicFields = useMemo(- () => [- {- title: "Name",- content: partner.name,- right: (- <img- src={partner.image || `${OG_AVATAR_URL}${partner.name}`}- alt={partner.name}- className="size-10 rounded-full"- />- ),- },- {- title: "Email",- content: partner.email,- },- {- title: "Location",- content: partner.country ? (- <div className="flex items-center gap-2">- <img- alt=""- src={`https://flag.vercel.app/m/${partner.country}.svg`}- className="h-3 w-4 shrink-0"- />- <span className="min-w-0 truncate">- {COUNTRIES[partner.country]}- </span>- </div>- ) : (- <span className="italic text-neutral-400">No location provided</span>- ),- },- {- title: "Description",- content: partner.description || (- <span className="italic text-neutral-400">- No description provided- </span>- ),- },- ],- [partner],- );-- return (- <>- <div className="flex grow flex-col">- <div className="flex h-16 items-center justify-between px-6 py-4">- <Sheet.Title className="text-lg font-semibold">- Partner profile- </Sheet.Title>- <div className="flex items-center gap-2">- <Sheet.Close asChild>- <Button- variant="outline"- icon={<X className="size-5" />}- className="h-auto w-fit p-1"- />- </Sheet.Close>- </div>- </div>- <div className="border-t border-neutral-200 p-6 text-sm text-neutral-600">- <div className="grid grid-cols-1 gap-4">- {basicFields.map((field) => (- <div- key={field.title}- className="flex items-start justify-between"- >- <div>- <h4 className="font-semibold text-neutral-900">- {field.title}- </h4>- <div className="mt-2">{field.content}</div>- </div>- {field.right}- </div>- ))}- <hr className="my-4 border-neutral-200" />- <div>- <h4 className="font-semibold text-neutral-900">- Online presence- </h4>- <OnlinePresenceSummary partner={partner} className="mt-3" />- </div>- </div>- </div>- </div>- </>- );-}--export function PartnerProfileSheet({- isOpen,- nested,- ...rest-}: PartnerProfileSheetProps & {- isOpen: boolean;- nested?: boolean;-}) {- const { queryParams } = useRouterStuff();- return (- <Sheet- open={isOpen}- onOpenChange={rest.setIsOpen}- onClose={() => queryParams({ del: "partnerId", scroll: false })}- nested={nested}- >- <PartnerProfileSheetContent {...rest} />- </Sheet>- );-}--export function usePartnerProfileSheet(- props: { nested?: boolean } & Omit<PartnerProfileSheetProps, "setIsOpen">,-) {- const [isOpen, setIsOpen] = useState(false);-- return {- partnerProfileSheet: (- <PartnerProfileSheet setIsOpen={setIsOpen} isOpen={isOpen} {...props} />- ),- setIsOpen,- };-}