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.

export: Fetch only recipient_id for my_subscriptions in user export.

Alex Vandiver7ac03835170c
diff --git a/zerver/lib/export.py b/zerver/lib/export.py
index 217daaaa7e1..2a772b8a862 100644
--- a/zerver/lib/export.py
+++ b/zerver/lib/export.py
@@ -2848,11 +2848,12 @@ def export_messages_single_user(
sender=user_profile,
)
- my_subscriptions = Subscription.objects.filter(
- user_profile=user_profile,
- recipient__type=Recipient.DIRECT_MESSAGE_GROUP,
+ my_recipient_ids = list(
+ Subscription.objects.filter(
+ user_profile=user_profile,
+ recipient__type=Recipient.DIRECT_MESSAGE_GROUP,
+ ).values_list("recipient_id", flat=True)
)
- my_recipient_ids = [sub.recipient_id for sub in my_subscriptions]
messages_to_me = Message.objects.filter(
# Uses index: zerver_message_realm_recipient_id (prefix)
realm_id=user_profile.realm_id,