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.

improve redirect logic

Steven Teyac13d86c0966
diff --git a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/page.tsx b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/page.tsx
index 8e33725776..e20e46a3f2 100644
--- a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/page.tsx
@@ -30,11 +30,11 @@ export default async function ApplicationPage(props: {
!program.group.applicationFormPublishedAt
) {
// for the default group:
- // - if the program is found, redirect to the marketplace program page
+ // - if the program is featured on the marketplace (and not deactivated), redirect to the marketplace program page
// - otherwise, throw 404
// for other groups: redirect to the default group variant
if (partnerGroupSlug === DEFAULT_PARTNER_GROUP.slug) {
- if (program) {
+ if (program && program.addedToMarketplaceAt && !program.deactivatedAt) {
redirect(`/marketplace/${programSlug}`);
}
notFound();
diff --git a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/success/page.tsx b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/success/page.tsx
index 4db7e547d9..69ba021b7e 100644
--- a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/success/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/success/page.tsx
@@ -66,11 +66,11 @@ export default async function SuccessPage(props: {
!program.group.applicationFormPublishedAt
) {
// for the default group:
- // - if the program is found, redirect to the marketplace program page
+ // - if the program is featured on the marketplace (and not deactivated), redirect to the marketplace program page
// - otherwise, throw 404
// for other groups: redirect to the default group variant
if (partnerGroupSlug === DEFAULT_PARTNER_GROUP.slug) {
- if (program) {
+ if (program && program.addedToMarketplaceAt && !program.deactivatedAt) {
redirect(`/marketplace/${programSlug}`);
}
notFound();
diff --git a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/page.tsx b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/page.tsx
index bb084d4277..2085e7d4b5 100644
--- a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/page.tsx
@@ -29,11 +29,11 @@ export default async function ApplyPage(props: {
!program.group.landerPublishedAt
) {
// for the default group:
- // - if the program is found, redirect to the marketplace program page
+ // - if the program is featured on the marketplace (and not deactivated), redirect to the marketplace program page
// - otherwise, throw 404
// for other groups: redirect to the default group variant
if (partnerGroupSlug === DEFAULT_PARTNER_GROUP.slug) {
- if (program) {
+ if (program && program.addedToMarketplaceAt && !program.deactivatedAt) {
redirect(`/marketplace/${programSlug}`);
}
notFound();