analytics: Display org_type in /activity/support results.

This commit is contained in:
Eeshan Garg 2021-07-02 16:27:37 -02:30 committed by Tim Abbott
parent 434c262365
commit 366b7fe2f5
3 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import orjson
from django.http import HttpResponse
from django.utils.timezone import now as timezone_now
from analytics.views.support import get_org_type_display_name
from corporate.lib.stripe import add_months, update_sponsorship_status
from corporate.models import Customer, CustomerPlan, LicenseLedger, get_customer_by_realm
from zerver.lib.actions import (
@ -70,10 +71,12 @@ class TestSupportEndpoint(ZulipTestCase):
def check_zulip_realm_query_result(result: HttpResponse) -> None:
zulip_realm = get_realm("zulip")
org_type_display_name = get_org_type_display_name(zulip_realm.org_type)
first_human_user = zulip_realm.get_first_human_user()
assert first_human_user is not None
self.assert_in_success_response(
[
f"<b>Organization type</b>: {org_type_display_name}",
f"<b>First human user</b>: {first_human_user.delivery_email}\n",
f'<input type="hidden" name="realm_id" value="{zulip_realm.id}"',
"Zulip Dev</h3>",

View File

@ -291,6 +291,7 @@ def support(request: HttpRequest) -> HttpResponse:
context["get_realm_owner_emails_as_string"] = get_realm_owner_emails_as_string
context["get_realm_admin_emails_as_string"] = get_realm_admin_emails_as_string
context["get_discount_for_realm"] = get_discount_for_realm
context["get_org_type_display_name"] = get_org_type_display_name
context["realm_icon_url"] = realm_icon_url
context["Confirmation"] = Confirmation
return render(request, "analytics/support.html", context=context)

View File

@ -4,6 +4,8 @@
<a target="_blank" rel="noopener noreferrer" href="/stats/realm/{{ realm.string_id }}/">stats</a> |
<a target="_blank" rel="noopener noreferrer" href="/realm_activity/{{ realm.string_id }}/">activity</a><br />
<b>Date created</b>: {{ realm.date_created|timesince }} ago<br />
{% set org_type_display_name = get_org_type_display_name(realm.org_type) %}
<b>Organization type</b>: {{ org_type_display_name }}<br />
{% set owner_emails_string = get_realm_owner_emails_as_string(realm) %}
<b>Owners</b>: {{ owner_emails_string }}
{% if owner_emails_string %}