support: Show role of the user in search result.

This commit is contained in:
Vishnu KS 2021-03-19 21:20:50 +05:30 committed by Tim Abbott
parent 91f048c056
commit 38e7903425
2 changed files with 18 additions and 1 deletions

View File

@ -579,6 +579,7 @@ class TestSupportEndpoint(ZulipTestCase):
"<h3>King Hamlet</h3>", "<h3>King Hamlet</h3>",
"<b>Email</b>: hamlet@zulip.com", "<b>Email</b>: hamlet@zulip.com",
"<b>Is active</b>: True<br>", "<b>Is active</b>: True<br>",
"<b>Role</b>: Member<br>",
"<b>Admins</b>: desdemona@zulip.com, iago@zulip.com\n", "<b>Admins</b>: desdemona@zulip.com, iago@zulip.com\n",
'class="copy-button" data-copytext="desdemona@zulip.com, iago@zulip.com"', 'class="copy-button" data-copytext="desdemona@zulip.com, iago@zulip.com"',
], ],
@ -592,6 +593,18 @@ class TestSupportEndpoint(ZulipTestCase):
"<h3>Othello, the Moor of Venice</h3>", "<h3>Othello, the Moor of Venice</h3>",
"<b>Email</b>: othello@zulip.com", "<b>Email</b>: othello@zulip.com",
"<b>Is active</b>: True<br>", "<b>Is active</b>: True<br>",
"<b>Role</b>: Member<br>",
],
result,
)
def check_polonius_user_query_result(result: HttpResponse) -> None:
self.assert_in_success_response(
[
"<h3>Polonius</h3>",
"<b>Email</b>: polonius@zulip.com",
"<b>Is active</b>: True<br>",
"<b>Role</b>: Guest<br>",
], ],
result, result,
) )
@ -731,6 +744,10 @@ class TestSupportEndpoint(ZulipTestCase):
check_hamlet_user_query_result(result) check_hamlet_user_query_result(result)
check_zulip_realm_query_result(result) check_zulip_realm_query_result(result)
result = self.client_get("/activity/support", {"q": self.example_email("polonius")})
check_polonius_user_query_result(result)
check_zulip_realm_query_result(result)
result = self.client_get("/activity/support", {"q": "lear"}) result = self.client_get("/activity/support", {"q": "lear"})
check_lear_realm_query_result(result) check_lear_realm_query_result(result)

View File

@ -40,7 +40,7 @@
<b>Email</b>: {{ user.email }}<br> <b>Email</b>: {{ user.email }}<br>
<b>Date joined</b>: {{ user.date_joined|timesince }} ago<br> <b>Date joined</b>: {{ user.date_joined|timesince }} ago<br>
<b>Is active</b>: {{ user.is_active }}<br> <b>Is active</b>: {{ user.is_active }}<br>
<b>Is admin</b>: {{ user.is_realm_admin }}<br> <b>Role</b>: {{ user.get_role_name() }}<br>
<hr> <hr>
<div> <div>
{% include "analytics/realm_details.html" %} {% include "analytics/realm_details.html" %}