Skip to content

Commit 5b0bd2a

Browse files
authored
Revert "Fix social metrics bounty flow - no draft state" (dubinc#3729)
1 parent 14b7bbd commit 5b0bd2a

File tree

3 files changed

+10
-58
lines changed

3 files changed

+10
-58
lines changed

apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/bounty-submissions-table.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
getSubmissionPeriods,
66
} from "@/lib/bounty/periods";
77
import { BOUNTY_SUBMISSION_STATUS_BADGES } from "@/lib/bounty/submission-status";
8+
import { resolveBountyDetails } from "@/lib/bounty/utils";
89
import { PartnerBountyProps, PartnerBountySubmission } from "@/lib/types";
910
import { useBountySubmissionDetailsSheet } from "@/ui/partners/bounties/bounty-submission-details-sheet";
1011
import { useClaimBountySheet } from "@/ui/partners/bounties/claim-bounty-sheet";
@@ -140,15 +141,18 @@ export function BountySubmissionsTable({
140141
size: 98,
141142
cell: ({ row: { original } }) => {
142143
const { status } = original;
144+
const bountyInfo = resolveBountyDetails(bounty);
143145
const isExpired =
144146
bounty.endsAt !== null && new Date(bounty.endsAt) < new Date();
145-
const isActionable = status === "notSubmitted" || status === "draft";
147+
const isActionable = bountyInfo?.hasSocialMetrics
148+
? status === "notSubmitted"
149+
: status === "notSubmitted" || status === "draft";
146150

147151
let buttonText = "Submit";
148152

149-
if (status === "draft") {
153+
if (status === "draft" && !bountyInfo?.hasSocialMetrics) {
150154
buttonText = "Continue";
151-
} else if (["submitted", "approved", "rejected"].includes(status)) {
155+
} else if (status !== "notSubmitted") {
152156
buttonText = "View";
153157
}
154158

apps/web/lib/bounty/api/create-bounty-submission.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,19 +231,8 @@ export class BountySubmissionHandler {
231231

232232
if (existingSubmission) {
233233
if (
234-
existingSubmission.reviewedAt ||
235-
existingSubmission.status === "approved" ||
236-
existingSubmission.status === "rejected"
237-
) {
238-
throw new DubApiError({
239-
code: "conflict",
240-
message: `You already have a ${existingSubmission.status} submission for this period.`,
241-
});
242-
}
243-
244-
if (
245-
existingSubmission.status !== "draft" &&
246-
!bountyInfo?.hasSocialMetrics
234+
existingSubmission.status !== "draft" ||
235+
bountyInfo?.hasSocialMetrics
247236
) {
248237
throw new DubApiError({
249238
code: "conflict",
@@ -519,10 +508,9 @@ export class BountySubmissionHandler {
519508
});
520509
}
521510

522-
// Note: We don't allow draft submission for social metrics bounties.
523511
this.submissionData = {
524512
...this.submissionData,
525-
status: "submitted",
513+
status: "draft",
526514
completedAt: null,
527515
};
528516

apps/web/scripts/misc/mark-bounties-submitted.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)