mirror of https://github.com/zulip/zulip.git
analytics: Add order_by to query used for fetching admin emails.
This commit adds order_by to the query that fetches admin emails in views.py. This is added to show emails alphabetically in case of multiple admins.
This commit is contained in:
parent
9b9aa23f6a
commit
36dca5ba5c
|
@ -18,7 +18,7 @@ from zerver.lib.test_classes import ZulipTestCase
|
|||
from zerver.lib.timestamp import ceiling_to_day, \
|
||||
ceiling_to_hour, datetime_to_timestamp
|
||||
from zerver.lib.actions import do_create_multiuse_invite_link, \
|
||||
do_send_realm_reactivation_email
|
||||
do_send_realm_reactivation_email, do_change_is_admin
|
||||
from zerver.models import Client, get_realm, MultiuseInvite
|
||||
|
||||
class TestStatsEndpoint(ZulipTestCase):
|
||||
|
@ -403,8 +403,8 @@ class TestSupportEndpoint(ZulipTestCase):
|
|||
def check_hamlet_user_query_result(result: HttpResponse) -> None:
|
||||
self.assert_in_success_response(['<span class="label">user</span>\n', '<h3>King Hamlet</h3>',
|
||||
'<b>Email</b>: hamlet@zulip.com', '<b>Is active</b>: True<br>',
|
||||
'<b>Admins</b>: iago@zulip.com\n',
|
||||
'class="copy-button" data-copytext="iago@zulip.com"'
|
||||
'<b>Admins</b>: iago@zulip.com, othello@zulip.com\n',
|
||||
'class="copy-button" data-copytext="iago@zulip.com, othello@zulip.com"'
|
||||
], result)
|
||||
|
||||
def check_zulip_realm_query_result(result: HttpResponse) -> None:
|
||||
|
@ -464,6 +464,9 @@ class TestSupportEndpoint(ZulipTestCase):
|
|||
'<b>Expires in</b>: 1\xa0day'
|
||||
], result)
|
||||
|
||||
othello = self.example_user('othello')
|
||||
do_change_is_admin(othello, True)
|
||||
|
||||
self.login('cordelia')
|
||||
|
||||
result = self.client_get("/activity/support")
|
||||
|
|
|
@ -1161,7 +1161,8 @@ def support(request: HttpRequest) -> HttpResponse:
|
|||
context["confirmations"] = confirmations
|
||||
|
||||
def realm_admin_emails(realm: Realm) -> str:
|
||||
return ", ".join(realm.get_human_admin_users().values_list("delivery_email", flat=True))
|
||||
return ", ".join(realm.get_human_admin_users().order_by('delivery_email').values_list(
|
||||
"delivery_email", flat=True))
|
||||
|
||||
context["realm_admin_emails"] = realm_admin_emails
|
||||
context["get_discount_for_realm"] = get_discount_for_realm
|
||||
|
|
Loading…
Reference in New Issue