reaction: Add user object back in reaction events.

The deprecated `user` object was removed from message objects
and reaction events in #32701. This commit restores the `user` object
in reaction events to maintain compatibility with mobile clients.
This commit is contained in:
Vector73
2025-01-12 13:48:06 +00:00
committed by Tim Abbott
parent 16188400f7
commit e487a5c8c7
7 changed files with 97 additions and 4 deletions

View File

@@ -20,10 +20,20 @@ from zerver.tornado.django_api import send_event_on_commit
def notify_reaction_update(
user_profile: UserProfile, message: Message, reaction: Reaction, op: str
) -> None:
user_dict = {
"user_id": user_profile.id,
"email": user_profile.email,
"full_name": user_profile.full_name,
}
event: dict[str, Any] = {
"type": "reaction",
"op": op,
"user_id": user_profile.id,
# TODO: We plan to remove this redundant user_dict object once
# clients are updated to support accessing use user_id. See
# https://github.com/zulip/zulip/pull/14711 for details.
"user": user_dict,
"message_id": message.id,
"emoji_name": reaction.emoji_name,
"emoji_code": reaction.emoji_code,