api: Improve consistency of reactions API.

Previously, the message and event APIs represented the user differently
for the same reaction data. To make this more consistent, I added a
user_id field to the reaction dict for both messages and events. I
updated the front end to use the user_id field rather than the user
dict. Lastly, I updated front end and back end tests that used user
info.

I primarily tested this by running my local Zulip build and
adding/removing reactions from messages.

Fixes #12049.
This commit is contained in:
rebtung
2020-04-22 17:24:28 -04:00
committed by Tim Abbott
parent 2a65be2bf5
commit f7fbe3419f
8 changed files with 57 additions and 48 deletions

View File

@@ -1670,6 +1670,10 @@ def notify_reaction_update(user_profile: UserProfile, message: Message,
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,