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.

small updates

Steven Teyc52c5c5b06cc
diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.ts
index d9938a22b2..9bffa2db3f 100644
--- a/apps/web/lib/actions/partners/update-partner-profile.ts
+++ b/apps/web/lib/actions/partners/update-partner-profile.ts
@@ -72,7 +72,7 @@ export const updatePartnerProfileAction = authPartnerActionClient
if (completedPayoutsCount > 0) {
throw new Error(
- "Since you've already received payouts on Dub, you cannot change your country. If you need to update your country, please contact support.",
+ "Since you've already received payouts on Dub, you cannot change your country or profile type. Please contact support to update those fields.",
);
}
diff --git a/apps/web/scripts/unsubscribe-inactive-users.ts b/apps/web/scripts/unsubscribe-inactive-users.ts
new file mode 100644
index 0000000000..96d0930622
--- /dev/null
+++ b/apps/web/scripts/unsubscribe-inactive-users.ts
@@ -0,0 +1,52 @@
+// @ts-nocheck – install resend lib before running this script
+
+import { limiter } from "@/lib/cron/limiter";
+import { prisma } from "@dub/prisma";
+import { Prisma } from "@prisma/client";
+import "dotenv-flow/config";
+import { Resend } from "resend";
+
+const resend = new Resend(process.env.RESEND_API_KEY);
+
+async function main() {
+ const where: Prisma.UserWhereInput = {
+ email: {
+ not: null,
+ },
+ subscribed: true,
+ // more than 6 months
+ createdAt: {
+ lte: new Date(Date.now() - 1000 * 60 * 60 * 24 * 180),
+ },
+ projects: {
+ none: {},
+ },
+ partners: {
+ none: {},
+ },
+ };
+
+ const users = await prisma.user.findMany({
+ where,
+ skip: 20000,
+ take: 5000,
+ });
+
+ console.table(users, ["email", "createdAt"]);
+
+ const response = await Promise.all(
+ users.map((user) =>
+ limiter.schedule(() =>
+ resend.contacts.remove({
+ email: user.email!,
+ audienceId: "f5ff0661-4234-43f6-b0ca-a3f3682934e3",
+ }),
+ ),
+ ),
+ );
+
+ console.table(response.map((r) => r.data));
+ console.log(`Removed ${response.length} users from Resend audience`);
+}
+
+main();