Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
billing_page: Redirect users on free plan to `/plans`.
Aman Agrawal9a186ac8d56c
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex f88ab93a999..ffb66fccb41 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -2333,7 +2333,7 @@ class StripeTest(StripeTestCase):customer = Customer.objects.create(realm=user.realm, stripe_customer_id="cus_123")response = self.client_get("/billing/")self.assertEqual(response.status_code, 302)- self.assertEqual("/upgrade/", response["Location"])+ self.assertEqual("/plans/", response["Location"])# Check redirects for sponsorship pendingcustomer.sponsorship_pending = True@@ -3103,9 +3103,8 @@ class StripeTest(StripeTestCase):self.login_user(user)response = self.client_get("/billing/")- self.assert_in_success_response(- ["Your organization is on the <b>Zulip Free</b>"], response- )+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/plans/", response["Location"])# The extra users added in the final month are not chargedwith patch("corporate.lib.stripe.invoice_plan") as mocked:@@ -3151,7 +3150,8 @@ class StripeTest(StripeTestCase):invoice_plans_as_needed(self.next_year)response = self.client_get("/billing/")- self.assert_in_success_response(["Your organization is on the <b>Zulip Free</b>"], response)+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/plans/", response["Location"])with patch("corporate.lib.stripe.timezone_now", return_value=self.next_year):self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)@@ -3462,7 +3462,8 @@ class StripeTest(StripeTestCase):self.login_user(user)response = self.client_get("/billing/")- self.assert_in_success_response(["Your organization is on the <b>Zulip Free</b>"], response)+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/plans/", response["Location"])# The extra users added in the final month are not chargedwith patch("corporate.lib.stripe.invoice_plan") as mocked:@@ -3486,7 +3487,8 @@ class StripeTest(StripeTestCase):self.login_user(user)response = self.client_get("/billing/")- self.assert_in_success_response(["Your organization is on the <b>Zulip Free</b>"], response)+ self.assertEqual(response.status_code, 302)+ self.assertEqual("/plans/", response["Location"])with patch("corporate.lib.stripe.timezone_now", return_value=self.now):self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, True, False)diff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.pyindex 23da665d3e9..96a1c584e79 100644--- a/corporate/views/billing_page.py+++ b/corporate/views/billing_page.py@@ -140,6 +140,9 @@ def billing_home(# TODO: Add a sponsorship pending message to the billing pagecontext["sponsorship_pending"] = True+ if user.realm.plan_type == user.realm.PLAN_TYPE_LIMITED:+ return HttpResponseRedirect(reverse("plans"))+if customer is None:from corporate.views.upgrade import initial_upgradediff --git a/templates/corporate/billing.html b/templates/corporate/billing.htmlindex adc7c1da480..1bdea3acb7a 100644--- a/templates/corporate/billing.html+++ b/templates/corporate/billing.html@@ -198,27 +198,9 @@To make changes to your plan or view your billing history <a href="mailto:[email protected]">contact Zulip support</a>.</p></div>- {% elif admin_access and not has_active_plan %}- <!-- For sponsored or sponsorship pending organizations we already redirect to /sponsorship page. -->- <div class="tab-content">- <center>- <p>- <h2>Your organization is on the <b>Zulip Free</b> plan.</h2>- <a href="/upgrade/">- <button type="submit" class="button green">Upgrade to Standard</button>- </a>- <a href="/plans/">- <button type="submit">View all plans</button>- </a>- </p>- </center>- </div>- <div class="support-link">- <p>- <a href="mailto:[email protected]">Contact Zulip support</a> for billing history.- </p>- </div>{% else %}+ <!-- For sponsored or sponsorship pending organizations we redirect to /sponsorship page. -->+ <!-- For organizations on free plan we redirect to /plans page. --><p>You must be an organization owner or a billing administrator to view this page.</p>@@ -294,7 +276,7 @@</header><main class="modal__content"><p>- Your organization will be downgraded to Zulip Cloud Free at the end of the current billing+ Your organization will be downgraded to <strong>Zulip Cloud Free</strong> at the end of the current billingperiod ({{ renewal_date }}). You will lose access to unlimited search history and<a href="/plans/">other features</a>of your current plan. Are you sure you want to continue?