The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix usePartnersCountBounty
Steven Teybbde1c06ec45
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.tsxindex 721c99207f..857fcc47ed 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@@ -54,10 +54,10 @@ function BountySubmissionDetailsSheetContent({executeAsync: approveBountySubmission,isPending: isApprovingBountySubmission,} = useAction(approveBountySubmissionAction, {- onSuccess: async () => {+ onSuccess: () => {toast.success("Bounty submission approved successfully!");onNext ? onNext() : setIsOpen(false);- await mutatePrefix(`/api/bounties/${bounty?.id}/submissions`);+ mutatePrefix(`/api/bounties/${bounty?.id}/submissions`);},onError({ error }) {toast.error(error.serverError);diff --git a/apps/web/lib/actions/partners/reject-bounty-submission.ts b/apps/web/lib/actions/partners/reject-bounty-submission.tsindex 2dec77c7d6..b0ad2bdbe7 100644--- a/apps/web/lib/actions/partners/reject-bounty-submission.ts+++ b/apps/web/lib/actions/partners/reject-bounty-submission.ts@@ -48,32 +48,18 @@ export const rejectBountySubmissionAction = authActionClientthrow new Error("Bounty submission already rejected.");}- await prisma.$transaction(async (tx) => {- await tx.bountySubmission.update({- where: {- id: submissionId,- },- data: {- status: "rejected",- reviewedAt: new Date(),- userId: user.id,- rejectionReason,- rejectionNote,- commissionId: null,- },- });-- if (bountySubmission.commissionId) {- await tx.commission.update({- where: {- id: bountySubmission.commissionId,- },- data: {- status: "canceled",- payoutId: null,- },- });- }+ await prisma.bountySubmission.update({+ where: {+ id: submissionId,+ },+ data: {+ status: "rejected",+ reviewedAt: new Date(),+ userId: user.id,+ rejectionReason,+ rejectionNote,+ commissionId: null,+ },});waitUntil(diff --git a/apps/web/lib/swr/use-partners-count-bounty.ts b/apps/web/lib/swr/use-partners-count-bounty.tsindex 4cd3684cde..8179dd7ff1 100644--- a/apps/web/lib/swr/use-partners-count-bounty.ts+++ b/apps/web/lib/swr/use-partners-count-bounty.ts@@ -11,6 +11,8 @@ export function usePartnersCountBounty({ bounty }: { bounty?: BountyProps }) {| undefined>({groupBy: "groupId",+ ignoreParams: true,+ enabled: !!bounty,});const totalPartnersForBounty = useMemo(() => {diff --git a/apps/web/scripts/perplexity/review-bounties.ts b/apps/web/scripts/perplexity/review-bounties.tsnew file mode 100644index 0000000000..4f43adf944--- /dev/null+++ b/apps/web/scripts/perplexity/review-bounties.ts@@ -0,0 +1,45 @@+import { prisma } from "@dub/prisma";+import "dotenv-flow/config";++// reject invalid bounty submissions+async function main() {+ const bountySubmissions = await prisma.bountySubmission.findMany({+ where: {+ bountyId: {+ in: [+ "bnty_1K7QH2WJPA1KRGM56VVW911XX",+ "bnty_1K7X45AGSP9PS7TA0F7YAD0M1",+ ],+ },+ status: "submitted",+ },+ });++ const invalidSubmissions = bountySubmissions.filter((submission) => {+ return (submission.urls as string[]).every(+ (url) => !url.includes("linkedin.com"),+ );+ });++ console.log(`Found ${invalidSubmissions.length} invalid bounty submissions`);++ const res = await prisma.bountySubmission.updateMany({+ where: {+ id: {+ in: invalidSubmissions.map((submission) => submission.id),+ },+ },+ data: {+ status: "rejected",+ reviewedAt: new Date(),+ userId: "user_1K1WRVWYV6VDPHF2N6KMRZBNX",+ rejectionReason: "invalidProof",+ rejectionNote: "Not a LinkedIn URL",+ commissionId: null,+ },+ });++ console.log(`Updated ${res.count} bounty submissions`);+}++main();diff --git a/apps/web/ui/partners/reject-bounty-submission-modal.tsx b/apps/web/ui/partners/reject-bounty-submission-modal.tsxindex 780d5a6016..8c18abdb66 100644--- a/apps/web/ui/partners/reject-bounty-submission-modal.tsx+++ b/apps/web/ui/partners/reject-bounty-submission-modal.tsx@@ -51,11 +51,11 @@ const RejectBountySubmissionModal = ({const { executeAsync: rejectBountySubmission, isPending } = useAction(rejectBountySubmissionAction,{- onSuccess: async () => {+ onSuccess: () => {toast.success("Bounty submission rejected successfully!");setShowModal(false);onReject ? onReject() : null;- await mutatePrefix(`/api/bounties/${bounty?.id}/submissions`);+ mutatePrefix(`/api/bounties/${bounty?.id}/submissions`);},onError({ error }) {toast.error(error.serverError);