diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.py index ac9ac33b2b..36c0f23422 100644 --- a/zerver/actions/message_edit.py +++ b/zerver/actions/message_edit.py @@ -40,7 +40,7 @@ from zerver.lib.message import ( topic_wildcard_mention_allowed, truncate_topic, ) -from zerver.lib.message_cache import update_to_dict_cache +from zerver.lib.message_cache import update_message_cache from zerver.lib.queue import queue_json_publish from zerver.lib.stream_subscription import get_active_subscriptions_for_stream_id from zerver.lib.stream_topic import StreamTopicTarget @@ -353,7 +353,7 @@ def do_update_embedded_data( message.save(update_fields=["content", "rendered_content"]) - event["message_ids"] = update_to_dict_cache(changed_messages) + event["message_ids"] = update_message_cache(changed_messages) def user_info(um: UserMessage) -> Dict[str, Any]: return { @@ -758,7 +758,7 @@ def do_update_message( if stream_being_edited is not None: realm_id = stream_being_edited.realm_id - event["message_ids"] = update_to_dict_cache(changed_messages, realm_id) + event["message_ids"] = update_message_cache(changed_messages, realm_id) def user_info(um: UserMessage) -> Dict[str, Any]: return { diff --git a/zerver/actions/reactions.py b/zerver/actions/reactions.py index 1d957771dc..0b668df8fe 100644 --- a/zerver/actions/reactions.py +++ b/zerver/actions/reactions.py @@ -10,7 +10,7 @@ from zerver.lib.message import ( should_change_visibility_policy, visibility_policy_for_participation, ) -from zerver.lib.message_cache import update_to_dict_cache +from zerver.lib.message_cache import update_message_cache from zerver.lib.stream_subscription import subscriber_ids_with_stream_history_access from zerver.lib.streams import access_stream_by_id from zerver.models import Message, Reaction, Recipient, Stream, UserMessage, UserProfile @@ -41,7 +41,7 @@ def notify_reaction_update( } # Update the cached message since new reaction is added. - update_to_dict_cache([message]) + update_message_cache([message]) # Recipients for message update events, including reactions, are # everyone who got the original message, plus subscribers of diff --git a/zerver/lib/message_cache.py b/zerver/lib/message_cache.py index 933126fb0f..2599ff0ad5 100644 --- a/zerver/lib/message_cache.py +++ b/zerver/lib/message_cache.py @@ -77,7 +77,7 @@ def message_to_dict_json(message: Message, realm_id: Optional[int] = None) -> by return MessageDict.to_dict_uncached([message], realm_id)[message.id] -def update_to_dict_cache( +def update_message_cache( changed_messages: Collection[Message], realm_id: Optional[int] = None ) -> List[int]: """Updates the message as stored in the to_dict cache (for serving