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.

support: Add plan type to remote server information.

Lauryn Menardcfd61669e0ee
diff --git a/analytics/tests/test_support_views.py b/analytics/tests/test_support_views.py
index 0edf07fcfd6..1ad13d6c38a 100644
--- a/analytics/tests/test_support_views.py
+++ b/analytics/tests/test_support_views.py
@@ -504,7 +504,7 @@ class TestSupportEndpoint(ZulipTestCase):
)
m.assert_called_once_with(get_realm("zulip"), 2, acting_user=iago)
self.assert_in_success_response(
- ["Plan type of zulip changed from self-hosted to limited"], result
+ ["Plan type of zulip changed from Self-hosted to Limited"], result
)
with mock.patch("analytics.views.support.do_change_realm_plan_type") as m:
@@ -513,7 +513,7 @@ class TestSupportEndpoint(ZulipTestCase):
)
m.assert_called_once_with(get_realm("zulip"), 10, acting_user=iago)
self.assert_in_success_response(
- ["Plan type of zulip changed from self-hosted to plus"], result
+ ["Plan type of zulip changed from Self-hosted to Plus"], result
)
def test_change_org_type(self) -> None:
diff --git a/analytics/views/installation_activity.py b/analytics/views/installation_activity.py
index 337a122e31f..5144e969c85 100644
--- a/analytics/views/installation_activity.py
+++ b/analytics/views/installation_activity.py
@@ -22,7 +22,7 @@ from analytics.views.activity_common import (
realm_support_link,
realm_url_link,
)
-from analytics.views.support import get_plan_name
+from analytics.views.support import get_plan_type_string
from zerver.decorator import require_server_admin
from zerver.lib.request import has_request_variables
from zerver.models import Realm, get_org_type_display_name
@@ -204,7 +204,7 @@ def realm_summary_table() -> str:
realms_with_default_discount = get_realms_with_default_discount_dict()
for row in rows:
- row["plan_type_string"] = get_plan_name(row["plan_type"])
+ row["plan_type_string"] = get_plan_type_string(row["plan_type"])
string_id = row["string_id"]
diff --git a/analytics/views/support.py b/analytics/views/support.py
index 30057189518..be8f4e0f673 100644
--- a/analytics/views/support.py
+++ b/analytics/views/support.py
@@ -66,13 +66,17 @@ if settings.BILLING_ENABLED:
from corporate.models import CustomerPlan
-def get_plan_name(plan_type: int) -> str:
+def get_plan_type_string(plan_type: int) -> str:
return {
- Realm.PLAN_TYPE_SELF_HOSTED: "self-hosted",
- Realm.PLAN_TYPE_LIMITED: "limited",
- Realm.PLAN_TYPE_STANDARD: "standard",
- Realm.PLAN_TYPE_STANDARD_FREE: "open source",
- Realm.PLAN_TYPE_PLUS: "plus",
+ Realm.PLAN_TYPE_SELF_HOSTED: "Self-hosted",
+ Realm.PLAN_TYPE_LIMITED: "Limited",
+ Realm.PLAN_TYPE_STANDARD: "Standard",
+ Realm.PLAN_TYPE_STANDARD_FREE: "Standard free",
+ Realm.PLAN_TYPE_PLUS: "Plus",
+ RemoteZulipServer.PLAN_TYPE_SELF_HOSTED: "Self-hosted",
+ RemoteZulipServer.PLAN_TYPE_COMMUNITY: "Community",
+ RemoteZulipServer.PLAN_TYPE_BUSINESS: "Business",
+ RemoteZulipServer.PLAN_TYPE_ENTERPRISE: "Enterprise",
}[plan_type]
@@ -210,7 +214,7 @@ def support(
elif plan_type is not None:
current_plan_type = realm.plan_type
do_change_realm_plan_type(realm, plan_type, acting_user=acting_user)
- msg = f"Plan type of {realm.string_id} changed from {get_plan_name(current_plan_type)} to {get_plan_name(plan_type)} "
+ msg = f"Plan type of {realm.string_id} changed from {get_plan_type_string(current_plan_type)} to {get_plan_type_string(plan_type)} "
context["success_message"] = msg
elif org_type is not None:
current_realm_type = realm.org_type
@@ -475,6 +479,7 @@ def remote_servers_support(
context["remote_server_to_max_monthly_messages"] = remote_server_to_max_monthly_messages
context["plan_data"] = plan_data
context["get_discount"] = get_customer_discount_for_support_view
+ context["get_plan_type_name"] = get_plan_type_string
return render(
request,
diff --git a/templates/analytics/remote_server_support.html b/templates/analytics/remote_server_support.html
index 0feee3df8cd..1b79940d827 100644
--- a/templates/analytics/remote_server_support.html
+++ b/templates/analytics/remote_server_support.html
@@ -45,6 +45,7 @@
<br />
<b>Last updated</b>: {{ remote_server.last_updated|timesince }} ago<br />
<b>Max monthly messages</b>: {{ remote_server_to_max_monthly_messages[remote_server.id] }}<br />
+ <b>Plan type</b>: {{ get_plan_type_name(remote_server.plan_type) }}<br />
{% if remote_server.plan_type == 100 %}
<h4>On 100% sponsored Zulip Community plan.</h4>
{% endif %}