mirror of https://github.com/zulip/zulip.git
message: Add realm limit to private-message summary query.
This query has two halves; messages set by the user, and messages received by the user. The former uses the already-specific usermessage privatemessage flag index; the latter relies on the recipient index on messages. Add the realm_id to the latter half, so that the recipient_id is paired with the realm_id.
This commit is contained in:
parent
d28d347c35
commit
ae822103a7
|
@ -1580,6 +1580,7 @@ def get_recent_private_conversations(user_profile: UserProfile) -> Dict[int, Dic
|
||||||
ON
|
ON
|
||||||
m.sender_id = sender_profile.id
|
m.sender_id = sender_profile.id
|
||||||
WHERE
|
WHERE
|
||||||
|
m.realm_id=%(realm_id)s AND
|
||||||
m.recipient_id=%(my_recipient_id)s
|
m.recipient_id=%(my_recipient_id)s
|
||||||
ORDER BY message_id DESC
|
ORDER BY message_id DESC
|
||||||
LIMIT %(conversation_limit)s)
|
LIMIT %(conversation_limit)s)
|
||||||
|
@ -1595,6 +1596,7 @@ def get_recent_private_conversations(user_profile: UserProfile) -> Dict[int, Dic
|
||||||
"user_profile_id": user_profile.id,
|
"user_profile_id": user_profile.id,
|
||||||
"conversation_limit": RECENT_CONVERSATIONS_LIMIT,
|
"conversation_limit": RECENT_CONVERSATIONS_LIMIT,
|
||||||
"my_recipient_id": my_recipient_id,
|
"my_recipient_id": my_recipient_id,
|
||||||
|
"realm_id": user_profile.realm_id,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
|
Loading…
Reference in New Issue