Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

plans: Don't hardcode plan_type values in template.

Vishnu KS44d836800311
diff --git a/templates/zerver/plans.html b/templates/zerver/plans.html
index 122df968d5a..a5cc5616581 100644
--- a/templates/zerver/plans.html
+++ b/templates/zerver/plans.html
@@ -38,14 +38,14 @@
</div>
<div class="bottom">
<div class="text-content">
- {% if realm_plan_type <= 1 %}
+ {% if not realm or realm.plan_type == realm.SELF_HOSTED %}
<div class="pricing-details">
Free
</div>
<a href="/new/" class="button green">
Sign up now
</a>
- {% elif realm_plan_type == 2 or sponsorship_pending %}
+ {% elif realm.plan_type == realm.LIMITED or sponsorship_pending %}
<div class="pricing-details"></div>
<a href='/upgrade' class="button black-current-value" type="button">
Current plan
@@ -81,11 +81,7 @@
$8/month billed monthly
</div>
</div>
- {% if realm_plan_type in [3, 4] %}
- <a href='/upgrade' class="button black-current-value" type="button">
- Current plan
- </a>
- {% elif realm_plan_type == 0 %}
+ {% if not realm %}
<a href="/new" class="button green">
{% if free_trial_days %}
Start {{ free_trial_days }} day free trial
@@ -93,6 +89,10 @@
Buy Standard
{% endif %}
</a>
+ {% elif realm.plan_type in [realm.STANDARD, realm.STANDARD_FREE] %}
+ <a href='/billing' class="button black-current-value" type="button">
+ Current plan
+ </a>
{% elif sponsorship_pending %}
<a href="/billing" class="button black-current-value" type="button">
Sponsorship pending
diff --git a/zerver/views/portico.py b/zerver/views/portico.py
index c527087d94e..611d704db36 100644
--- a/zerver/views/portico.py
+++ b/zerver/views/portico.py
@@ -35,7 +35,6 @@ def app_download_link_redirect(request: HttpRequest, platform: str) -> HttpRespo
@add_google_analytics
def plans_view(request: HttpRequest) -> HttpResponse:
realm = get_realm_from_request(request)
- realm_plan_type = 0
free_trial_days = settings.FREE_TRIAL_DAYS
sponsorship_pending = False
sponsorship_url = "/upgrade#sponsorship"
@@ -44,7 +43,6 @@ def plans_view(request: HttpRequest) -> HttpResponse:
sponsorship_url = f"/accounts/go/?next={urllib.parse.quote(sponsorship_url)}"
if realm is not None:
- realm_plan_type = realm.plan_type
if realm.plan_type == Realm.SELF_HOSTED and settings.PRODUCTION:
return HttpResponseRedirect("https://zulip.com/plans")
if not request.user.is_authenticated:
@@ -62,7 +60,7 @@ def plans_view(request: HttpRequest) -> HttpResponse:
request,
"zerver/plans.html",
context={
- "realm_plan_type": realm_plan_type,
+ "realm": realm,
"free_trial_days": free_trial_days,
"sponsorship_pending": sponsorship_pending,
"sponsorship_url": sponsorship_url,