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.

Update update-partner-profile.ts

Steven Tey23a9a7acdd2f
diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.ts
index eda2a0caf5..d9938a22b2 100644
--- a/apps/web/lib/actions/partners/update-partner-profile.ts
+++ b/apps/web/lib/actions/partners/update-partner-profile.ts
@@ -61,18 +61,16 @@ export const updatePartnerProfileAction = authPartnerActionClient
partner.companyName?.toLowerCase() !== companyName?.toLowerCase();
if (countryChanged || profileTypeChanged || companyNameChanged) {
- // Partner should be able to update their country, profile type, or company name
- // if they don't have any sent payouts
- const sentPayoutsCount = await prisma.payout.count({
+ // Partner is only able to update their country, profile type, or company name
+ // as long as they don't have any completed payouts
+ const completedPayoutsCount = await prisma.payout.count({
where: {
partnerId: partner.id,
- status: {
- in: ["processing", "completed"],
- },
+ status: "completed",
},
});
- if (sentPayoutsCount > 0) {
+ 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.",
);