mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
message_edit: Fix recipient of event due to 'do_update_embedded_data'.
This commit updates the 'do_update_embedded_data' function to use the generic 'event_recipient_ids_for_action_on_messages' function while deciding the event's recipients. It helps to add hardening such that if the invariant "no usermessage row corresponding to a message exists if the user loses access to the message" is violated due to some bug, it has minimal user impact.
This commit is contained in:
committed by
Tim Abbott
parent
0d28323b1a
commit
ce6b5cf068
@@ -38,6 +38,7 @@ from zerver.lib.message import (
|
|||||||
access_message,
|
access_message,
|
||||||
bulk_access_stream_messages_query,
|
bulk_access_stream_messages_query,
|
||||||
check_user_group_mention_allowed,
|
check_user_group_mention_allowed,
|
||||||
|
event_recipient_ids_for_action_on_messages,
|
||||||
normalize_body,
|
normalize_body,
|
||||||
stream_wildcard_mention_allowed,
|
stream_wildcard_mention_allowed,
|
||||||
topic_wildcard_mention_allowed,
|
topic_wildcard_mention_allowed,
|
||||||
@@ -397,13 +398,16 @@ def do_update_embedded_data(
|
|||||||
"rendering_only": True,
|
"rendering_only": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
users_to_notify = event_recipient_ids_for_action_on_messages([message])
|
||||||
|
filtered_ums = [um for um in ums if um.user_profile_id in users_to_notify]
|
||||||
|
|
||||||
def user_info(um: UserMessage) -> dict[str, Any]:
|
def user_info(um: UserMessage) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"id": um.user_profile_id,
|
"id": um.user_profile_id,
|
||||||
"flags": um.flags_list(),
|
"flags": um.flags_list(),
|
||||||
}
|
}
|
||||||
|
|
||||||
send_event_on_commit(user_profile.realm, event, list(map(user_info, ums)))
|
send_event_on_commit(user_profile.realm, event, list(map(user_info, filtered_ums)))
|
||||||
|
|
||||||
|
|
||||||
def get_visibility_policy_after_merge(
|
def get_visibility_policy_after_merge(
|
||||||
|
|||||||
Reference in New Issue
Block a user