mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +00:00
support: Add plan type to remote server information.
Updates `get_plan_type_string` for RemoteZulipServer plan types and capitalizes the strings used for Realm plan types. Also changes the string for Realm.PLAN_TYPE_STANDARD_FREE to be "Standard free" instead of "open source" as that is used for any 100% sponsored organization, which is not restricted to open-source projects.
This commit is contained in:
committed by
Tim Abbott
parent
6c5b419267
commit
cfd61669e0
@@ -504,7 +504,7 @@ class TestSupportEndpoint(ZulipTestCase):
|
|||||||
)
|
)
|
||||||
m.assert_called_once_with(get_realm("zulip"), 2, acting_user=iago)
|
m.assert_called_once_with(get_realm("zulip"), 2, acting_user=iago)
|
||||||
self.assert_in_success_response(
|
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:
|
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)
|
m.assert_called_once_with(get_realm("zulip"), 10, acting_user=iago)
|
||||||
self.assert_in_success_response(
|
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:
|
def test_change_org_type(self) -> None:
|
||||||
|
@@ -22,7 +22,7 @@ from analytics.views.activity_common import (
|
|||||||
realm_support_link,
|
realm_support_link,
|
||||||
realm_url_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.decorator import require_server_admin
|
||||||
from zerver.lib.request import has_request_variables
|
from zerver.lib.request import has_request_variables
|
||||||
from zerver.models import Realm, get_org_type_display_name
|
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()
|
realms_with_default_discount = get_realms_with_default_discount_dict()
|
||||||
|
|
||||||
for row in rows:
|
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"]
|
string_id = row["string_id"]
|
||||||
|
|
||||||
|
@@ -66,13 +66,17 @@ if settings.BILLING_ENABLED:
|
|||||||
from corporate.models import CustomerPlan
|
from corporate.models import CustomerPlan
|
||||||
|
|
||||||
|
|
||||||
def get_plan_name(plan_type: int) -> str:
|
def get_plan_type_string(plan_type: int) -> str:
|
||||||
return {
|
return {
|
||||||
Realm.PLAN_TYPE_SELF_HOSTED: "self-hosted",
|
Realm.PLAN_TYPE_SELF_HOSTED: "Self-hosted",
|
||||||
Realm.PLAN_TYPE_LIMITED: "limited",
|
Realm.PLAN_TYPE_LIMITED: "Limited",
|
||||||
Realm.PLAN_TYPE_STANDARD: "standard",
|
Realm.PLAN_TYPE_STANDARD: "Standard",
|
||||||
Realm.PLAN_TYPE_STANDARD_FREE: "open source",
|
Realm.PLAN_TYPE_STANDARD_FREE: "Standard free",
|
||||||
Realm.PLAN_TYPE_PLUS: "plus",
|
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]
|
}[plan_type]
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +214,7 @@ def support(
|
|||||||
elif plan_type is not None:
|
elif plan_type is not None:
|
||||||
current_plan_type = realm.plan_type
|
current_plan_type = realm.plan_type
|
||||||
do_change_realm_plan_type(realm, plan_type, acting_user=acting_user)
|
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
|
context["success_message"] = msg
|
||||||
elif org_type is not None:
|
elif org_type is not None:
|
||||||
current_realm_type = realm.org_type
|
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["remote_server_to_max_monthly_messages"] = remote_server_to_max_monthly_messages
|
||||||
context["plan_data"] = plan_data
|
context["plan_data"] = plan_data
|
||||||
context["get_discount"] = get_customer_discount_for_support_view
|
context["get_discount"] = get_customer_discount_for_support_view
|
||||||
|
context["get_plan_type_name"] = get_plan_type_string
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<b>Last updated</b>: {{ remote_server.last_updated|timesince }} ago<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>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 %}
|
{% if remote_server.plan_type == 100 %}
|
||||||
<h4>On 100% sponsored Zulip Community plan.</h4>
|
<h4>On 100% sponsored Zulip Community plan.</h4>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user