mirror of https://github.com/zulip/zulip.git
Remove client-specific tabs from activity overview page.
Waseem is ok with removing the client-specific tabs on the main /activity page. This reduces the number of queries from 25 to 1. We might eventually restore some of that logic, but we will do it more efficiently. A lot of the data for non-website clients is kind of unreliable, anyway. The page looks kind of funny with only one tab, but that will be fixed in the next commit. (imported from commit 54f08f89d5242ad3e045d8ca0d97b86617c15380)
This commit is contained in:
parent
374a64acf8
commit
786c2cf759
|
@ -347,7 +347,7 @@ class ActivityTest(AuthedTestCase):
|
|||
)
|
||||
with queries_captured() as queries:
|
||||
self.client.get('/activity')
|
||||
self.assertEqual(len(queries), 25)
|
||||
self.assertEqual(len(queries), 1)
|
||||
|
||||
class PublicURLTest(TestCase):
|
||||
"""
|
||||
|
|
|
@ -1779,12 +1779,9 @@ class ActivityTable(object):
|
|||
|
||||
records = UserActivity.objects.filter(
|
||||
query=url,
|
||||
client__name__startswith=client_name
|
||||
client__name__startswith=client_name,
|
||||
user_profile__realm__domain=realm
|
||||
)
|
||||
|
||||
if realm:
|
||||
records = records.filter(user_profile__realm__domain=realm)
|
||||
|
||||
records = records.select_related().only(*fields)
|
||||
|
||||
count_field = query_name + '_count'
|
||||
|
@ -1797,7 +1794,6 @@ class ActivityTable(object):
|
|||
count = record.count
|
||||
last_visit = record.last_visit
|
||||
|
||||
if realm:
|
||||
row = self.rows.setdefault(email,
|
||||
{'realm': domain,
|
||||
'full_name': full_name,
|
||||
|
@ -1806,18 +1802,6 @@ class ActivityTable(object):
|
|||
row[count_field] = count
|
||||
row[last_visit_field] = last_visit
|
||||
|
||||
else:
|
||||
row = self.rows.setdefault(domain,
|
||||
{'realm': domain,
|
||||
'type': 'realm'})
|
||||
row.setdefault(count_field, 0)
|
||||
row[count_field] += count
|
||||
|
||||
if last_visit_field in row:
|
||||
row[last_visit_field] = max(last_visit, row[last_visit_field])
|
||||
else:
|
||||
row[last_visit_field] = last_visit
|
||||
|
||||
|
||||
for query_name, urls in queries:
|
||||
if 'pointer' in query_name:
|
||||
|
@ -1940,12 +1924,12 @@ def get_activity(request, realm=REQ(default=None)):
|
|||
("send_message", ["/api/v1/send_message"]),
|
||||
)
|
||||
|
||||
data = []
|
||||
|
||||
if realm is None:
|
||||
data.append(('General', realm_summary_table()))
|
||||
|
||||
data += [
|
||||
data = [
|
||||
('Counts', realm_summary_table())
|
||||
]
|
||||
else:
|
||||
data = [
|
||||
('Website', ActivityTable(realm, 'website', web_queries)),
|
||||
('Mirror', ActivityTable(realm, 'zephyr_mirror', api_queries)),
|
||||
('Desktop', ActivityTable(realm, 'desktop', web_queries)),
|
||||
|
|
Loading…
Reference in New Issue