zerver: Rename some message_type variables to recipient_type.

This commit is contained in:
Mateusz Mandera 2024-09-10 20:45:21 +02:00 committed by Tim Abbott
parent 8505de7b19
commit 6ce096c0ff
3 changed files with 7 additions and 7 deletions

View File

@ -1082,12 +1082,12 @@ def do_send_messages(
users.append(user_data)
sender = send_request.message.sender
message_type = wide_message_dict["type"]
recipient_type = wide_message_dict["type"]
user_notifications_data_list = [
UserMessageNotificationsData.from_user_id_sets(
user_id=user_id,
flags=user_flags.get(user_id, []),
private_message=message_type == "private",
private_message=recipient_type == "private",
disable_external_notifications=send_request.disable_external_notifications,
online_push_user_ids=send_request.online_push_user_ids,
dm_mention_push_disabled_user_ids=send_request.dm_mention_push_disabled_user_ids,

View File

@ -62,11 +62,11 @@ def backfill_message_edit_history_chunk(
for message in messages:
legacy_edit_history: list[LegacyEditHistoryEvent] = orjson.loads(message.edit_history)
message_type = message.recipient.type
recipient_type = message.recipient.type
modern_edit_history: list[EditHistoryEvent] = []
# Only Stream messages have topic / stream edit history data.
if message_type == STREAM:
if recipient_type == STREAM:
topic = message.subject
stream_id = message.recipient.type_id
@ -83,7 +83,7 @@ def backfill_message_edit_history_chunk(
"prev_rendered_content_version"
]
if message_type == STREAM:
if recipient_type == STREAM:
if "prev_subject" in edit_history_event:
# Add topic edit key/value pairs from legacy format.
modern_entry["topic"] = topic

View File

@ -488,7 +488,7 @@ class TestServiceBotEventTriggers(ZulipTestCase):
content = "@**FooBot** foo bar!!!"
recipient = "Denmark"
trigger = "mention"
message_type = Recipient._type_names[Recipient.STREAM]
recipient_type = Recipient._type_names[Recipient.STREAM]
def check_values_passed(
queue_name: Any,
@ -500,7 +500,7 @@ class TestServiceBotEventTriggers(ZulipTestCase):
self.assertEqual(trigger_event["message"]["content"], content)
self.assertEqual(trigger_event["message"]["display_recipient"], recipient)
self.assertEqual(trigger_event["message"]["sender_email"], self.user_profile.email)
self.assertEqual(trigger_event["message"]["type"], message_type)
self.assertEqual(trigger_event["message"]["type"], recipient_type)
self.assertEqual(trigger_event["trigger"], trigger)
self.assertEqual(trigger_event["user_profile_id"], self.bot_profile.id)