message_cache: Use the sender’s recipient_id for incoming 1:1 DMs.

For an incoming 1:1 DM, the recipient’s own recipient_id is useless to
the recipient themselves. Substitute the sender’s recipient_id, so the
recipient can use recipient_id as documented to uniquely represent the
set of 2 users in this conversation.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-12-05 12:44:27 -08:00
committed by Tim Abbott
parent 6ef0f0c072
commit e2d56db2a3
14 changed files with 120 additions and 12 deletions

View File

@@ -253,7 +253,13 @@ def messages_for_ids(
msg_dict["can_access_sender"] = msg_dict["sender_id"] not in inaccessible_sender_ids
message_list.append(msg_dict)
MessageDict.post_process_dicts(message_list, apply_markdown, client_gravatar, realm)
MessageDict.post_process_dicts(
message_list,
apply_markdown=apply_markdown,
client_gravatar=client_gravatar,
realm=realm,
user_recipient_id=None if user_profile is None else user_profile.recipient_id,
)
return message_list