Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix messaging logic

Steven Tey1854cb73bde4
diff --git a/apps/web/lib/messages/message-program.ts b/apps/web/lib/messages/message-program.ts
index a6f61aeee2..afcf883a0d 100644
--- a/apps/web/lib/messages/message-program.ts
+++ b/apps/web/lib/messages/message-program.ts
@@ -7,7 +7,7 @@ import { prisma } from "@/lib/prisma";
import { APP_DOMAIN_WITH_NGROK, INTERCOM_INTEGRATION_ID } from "@dub/utils";
import { waitUntil } from "@vercel/functions";
import { authPartnerActionClient } from "../actions/safe-action";
-import { INACTIVE_ENROLLMENT_STATUSES } from "../zod/schemas/partners";
+import { COMMISSION_ELIGIBLE_ENROLLMENT_STATUSES } from "../zod/schemas/partners";
import { MessageSchema, messageProgramSchema } from "./schemas";
import {
mapMessageAttachmentsForCreate,
@@ -40,12 +40,12 @@ export const messageProgramAction = authPartnerActionClient
messagingEnabledAt: {
not: null,
},
- // partner is not banned, deactivated, or rejected
+ // partner is active, archived or invited
partners: {
some: {
partnerId: partner.id,
status: {
- notIn: INACTIVE_ENROLLMENT_STATUSES,
+ in: COMMISSION_ELIGIBLE_ENROLLMENT_STATUSES,
},
},
},
diff --git a/apps/web/lib/messages/upload-partner-message-attachment.ts b/apps/web/lib/messages/upload-partner-message-attachment.ts
index 54f7d7c027..9d6e0c4cfa 100644
--- a/apps/web/lib/messages/upload-partner-message-attachment.ts
+++ b/apps/web/lib/messages/upload-partner-message-attachment.ts
@@ -13,7 +13,7 @@ import { RATELIMIT_POLICIES } from "@/lib/upstash/ratelimit-policies";
import { nanoid } from "@dub/utils";
import * as z from "zod/v4";
import { authPartnerActionClient } from "../actions/safe-action";
-import { INACTIVE_ENROLLMENT_STATUSES } from "../zod/schemas/partners";
+import { COMMISSION_ELIGIBLE_ENROLLMENT_STATUSES } from "../zod/schemas/partners";
const schema = z.object({
programSlug: z.string(),
@@ -52,12 +52,12 @@ export const uploadPartnerMessageAttachmentAction = authPartnerActionClient
messagingEnabledAt: {
not: null,
},
- // partner is not banned, deactivated, or rejected
+ // partner is active, archived or invited
partners: {
some: {
partnerId: partner.id,
status: {
- notIn: INACTIVE_ENROLLMENT_STATUSES,
+ in: COMMISSION_ELIGIBLE_ENROLLMENT_STATUSES,
},
},
},