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.

add total links transferred to the email

Kiran Ke2c6834ae247
diff --git a/apps/web/app/api/cron/domains/transfer/route.ts b/apps/web/app/api/cron/domains/transfer/route.ts
index 8468bf4247..b74da222f9 100644
--- a/apps/web/app/api/cron/domains/transfer/route.ts
+++ b/apps/web/app/api/cron/domains/transfer/route.ts
@@ -13,6 +13,7 @@ const schema = z.object({
currentWorkspaceId: z.string(),
newWorkspaceId: z.string(),
domain: z.string(),
+ linksCount: z.number(),
});
export async function POST(req: Request) {
@@ -29,7 +30,8 @@ export async function POST(req: Request) {
}
}
- const { currentWorkspaceId, newWorkspaceId, domain } = schema.parse(body);
+ const { currentWorkspaceId, newWorkspaceId, domain, linksCount } =
+ schema.parse(body);
const links = await prisma.link.findMany({
where: { domain, projectId: currentWorkspaceId },
@@ -42,6 +44,7 @@ export async function POST(req: Request) {
domain,
currentWorkspaceId,
newWorkspaceId,
+ linksCount,
});
return NextResponse.json({
@@ -78,6 +81,7 @@ export async function POST(req: Request) {
domain,
currentWorkspaceId,
newWorkspaceId,
+ linksCount,
});
}
diff --git a/apps/web/app/api/cron/domains/transfer/utils.ts b/apps/web/app/api/cron/domains/transfer/utils.ts
index af90912717..88fb651df6 100644
--- a/apps/web/app/api/cron/domains/transfer/utils.ts
+++ b/apps/web/app/api/cron/domains/transfer/utils.ts
@@ -43,10 +43,12 @@ export const domainTransferredEmail = async ({
domain,
currentWorkspaceId,
newWorkspaceId,
+ linksCount,
}: {
domain: string;
currentWorkspaceId: string;
newWorkspaceId: string;
+ linksCount: number;
}) => {
const currentWorkspace = await prisma.project.findUnique({
where: {
@@ -87,6 +89,7 @@ export const domainTransferredEmail = async ({
email: ownerEmail,
domain,
newWorkspace,
+ linksCount,
}),
});
};
diff --git a/apps/web/app/api/domains/[domain]/transfer/route.ts b/apps/web/app/api/domains/[domain]/transfer/route.ts
index cab77def57..5d7432061c 100644
--- a/apps/web/app/api/domains/[domain]/transfer/route.ts
+++ b/apps/web/app/api/domains/[domain]/transfer/route.ts
@@ -149,6 +149,7 @@ export const POST = withAuth(
currentWorkspaceId: workspace.id,
newWorkspaceId,
domain,
+ linksCount,
},
});
diff --git a/apps/web/emails/domain-transferred.tsx b/apps/web/emails/domain-transferred.tsx
index 19ab03ddf0..c8cf027fff 100644
--- a/apps/web/emails/domain-transferred.tsx
+++ b/apps/web/emails/domain-transferred.tsx
@@ -19,10 +19,12 @@ export default function DomainTransferred({
email = "[email protected]",
domain = "dub.sh",
newWorkspace = { name: "Dub", slug: "dub" },
+ linksCount = 50,
}: {
email: string;
domain: string;
newWorkspace: Pick<Project, "name" | "slug">;
+ linksCount: number;
}) {
return (
<Html>
@@ -44,8 +46,11 @@ export default function DomainTransferred({
Domain Transferred
</Heading>
<Text className="text-sm leading-6 text-black">
- Your domain <code className="text-purple-600">{domain}</code> and
- its links has been transferred to the workspace{" "}
+ Your domain <code className="text-purple-600">{domain}</code>{" "}
+ {linksCount > 0 && (
+ <>and its {linksCount > 0 ? linksCount : ""} links </>
+ )}
+ has been transferred to the workspace{" "}
<Link
href={`https://app.dub.co/${newWorkspace.slug}/domains`}
className="font-medium text-blue-600 no-underline"