Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

performance: Use values_list for message edits.

Steve Howella518cea65d03
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index c8a2e87d0dd..89c67b34910 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -5982,7 +5982,7 @@ def do_update_message(
# All users that are subscribed to the stream must be
# notified when a message is edited
- subscriber_ids = [user.user_profile_id for user in subscriptions]
+ subscriber_ids = set(subscriptions.values_list("user_profile_id", flat=True))
if new_stream is not None:
# TODO: Guest users don't see the new moved topic
@@ -6004,9 +6004,9 @@ def do_update_message(
subscriptions = subscriptions.exclude(
user_profile_id__in=[sub.user_profile_id for sub in old_stream_unsubbed_guests]
)
- subscriber_ids = [user.user_profile_id for user in subscriptions]
+ subscriber_ids = set(subscriptions.values_list("user_profile_id", flat=True))
- users_to_be_notified += list(map(subscriber_info, subscriber_ids))
+ users_to_be_notified += list(map(subscriber_info, sorted(list(subscriber_ids))))
send_event(user_profile.realm, event, users_to_be_notified)