Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
narrow: Perform _get_direct_message_group_recipients in the database.
Alex Vandiver8fddc15fe560
diff --git a/zerver/lib/narrow.py b/zerver/lib/narrow.pyindex bc2df32811c..4bd9071b99a 100644--- a/zerver/lib/narrow.py+++ b/zerver/lib/narrow.py@@ -647,22 +647,19 @@ class NarrowBuilder:return query.where(maybe_negate(cond))def _get_direct_message_group_recipients(self, other_user: UserProfile) -> set[int]:- self_recipient_ids = [- recipient_tuple["recipient_id"]- for recipient_tuple in Subscription.objects.filter(+ return set(+ Subscription.objects.filter(user_profile=self.user_profile,recipient__type=Recipient.DIRECT_MESSAGE_GROUP,- ).values("recipient_id")- ]- narrow_recipient_ids = [- recipient_tuple["recipient_id"]- for recipient_tuple in Subscription.objects.filter(- user_profile=other_user,- recipient__type=Recipient.DIRECT_MESSAGE_GROUP,- ).values("recipient_id")- ]-- return set(self_recipient_ids) & set(narrow_recipient_ids)+ )+ .values_list("recipient_id", flat=True)+ .intersection(+ Subscription.objects.filter(+ user_profile=other_user,+ recipient__type=Recipient.DIRECT_MESSAGE_GROUP,+ ).values_list("recipient_id", flat=True)+ )+ )def by_dm_including(self, query: Select, operand: str | int, maybe_negate: ConditionTransform