rocketchat: Handle PMs with only one recipient.

These are either to a deleted user, or actually to the same user.  In
any case, treat them as self-messages.
This commit is contained in:
Alex Vandiver 2022-07-14 17:35:51 -07:00 committed by Tim Abbott
parent 51421f378b
commit e653bb2733
1 changed files with 4 additions and 0 deletions

View File

@ -637,6 +637,10 @@ def process_messages(
message_dict["recipient_id"] = huddle_id_to_recipient_id[huddle_id]
else:
rc_member_ids = direct_id_to_direct_map[rc_channel_id]["uids"]
if len(rc_member_ids) == 1: # nocoverage
# PMs to yourself only have one user.
rc_member_ids.append(rc_member_ids[0])
if rc_sender_id == rc_member_ids[0]:
zulip_member_id = user_id_mapper.get(rc_member_ids[1])
message_dict["recipient_id"] = user_id_to_recipient_id[zulip_member_id]