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-search: Limit to only the fields we need.

Alex Vandivere9c6856d020d
diff --git a/zerver/management/commands/export_search.py b/zerver/management/commands/export_search.py
index a5aa0d6018f..c2302e3aa24 100644
--- a/zerver/management/commands/export_search.py
+++ b/zerver/management/commands/export_search.py
@@ -204,6 +204,17 @@ This is most often used for legal compliance.
messages_query = (
Message.objects.filter(limits, realm=realm)
.select_related("sender")
+ .only(
+ "id",
+ "date_sent",
+ "sender__full_name",
+ "sender__delivery_email",
+ "recipient_id",
+ "subject",
+ "content",
+ "edit_history",
+ "has_attachment",
+ )
.order_by("date_sent")
)
print(f"Exporting {len(messages_query)} messages...")