mirror of https://github.com/zulip/zulip.git
presence: Fix loop making database queries.
The previous select_related didn't properly get the User object, containing the email address, and thus would make one query per user with presernce information. (imported from commit 3341bc5a65387030fa8737b03ca43f79089ef56b)
This commit is contained in:
parent
7e09166f45
commit
62c632ceef
|
@ -1343,7 +1343,8 @@ def get_status_list(requesting_user_profile):
|
|||
return json_success({'presences': user_statuses})
|
||||
|
||||
for presence in UserPresence.objects.filter(
|
||||
user_profile__realm=requesting_user_profile.realm).select_related('user_profile', 'client'):
|
||||
user_profile__realm=requesting_user_profile.realm).select_related(
|
||||
'user_profile', 'user_profile__user', 'client'):
|
||||
|
||||
user_statuses[presence.user_profile.user.email][presence.client.name] = \
|
||||
presence_to_dict(presence)
|
||||
|
|
Loading…
Reference in New Issue