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.

Skip merge-partner email notifications in e2e tests (#4467)

Kiran K0533d2f6b8d2
diff --git a/apps/web/app/(ee)/api/e2e/trigger-merge-accounts/route.ts b/apps/web/app/(ee)/api/e2e/trigger-merge-accounts/route.ts
index 74b1d7fd10..8d34775671 100644
--- a/apps/web/app/(ee)/api/e2e/trigger-merge-accounts/route.ts
+++ b/apps/web/app/(ee)/api/e2e/trigger-merge-accounts/route.ts
@@ -58,6 +58,7 @@ export const POST = withWorkspace(
userId,
sourceEmail,
targetEmail,
+ skipEmailNotification: true,
},
options: {
flowControl: {
diff --git a/apps/web/app/(ee)/api/workflows/merge-partner-accounts/route.ts b/apps/web/app/(ee)/api/workflows/merge-partner-accounts/route.ts
index 3cac55594d..085831fea5 100644
--- a/apps/web/app/(ee)/api/workflows/merge-partner-accounts/route.ts
+++ b/apps/web/app/(ee)/api/workflows/merge-partner-accounts/route.ts
@@ -25,6 +25,8 @@ const inputSchema = z.object({
userId: z.string(),
sourceEmail: z.string(),
targetEmail: z.string(),
+ // When true (e.g. e2e tests) skip the email notification
+ skipEmailNotification: z.boolean().optional().default(false),
});
type Input = z.infer<typeof inputSchema>;
@@ -48,7 +50,8 @@ const CACHE_KEY_PREFIX = "merge-partner-accounts";
// POST /api/workflows/merge-partner-accounts
export const { POST } = serve<Input>(
async (context) => {
- const { userId, sourceEmail, targetEmail } = context.requestPayload;
+ const { userId, sourceEmail, targetEmail, skipEmailNotification } =
+ context.requestPayload;
// Step 1: Resolve + validate accounts and build the merge plan
const plan = await context.run("load-merge-plan", async () => {
@@ -156,6 +159,12 @@ export const { POST } = serve<Input>(
await context.run("send-merged-emails", async () => {
await redis.del(`${CACHE_KEY_PREFIX}:${userId}`);
+ if (skipEmailNotification) {
+ return logAndReturn({
+ outputLog: `Partner account ${sourceEmail} merged into ${targetEmail}. Skipped email notification.`,
+ });
+ }
+
const resendBatchEmailRes = await sendBatchEmail(
[
{