Skip to content

Commit

Permalink
api: On reaction events, stop assuming old user object is present
Browse files Browse the repository at this point in the history
The `user_id` field has been present in reaction events since Zulip
3.0 (FL 2), which is below our kMinAllowedServerVersion (4.0). See
API docs:
  https://zulip.com/api/get-events#reaction-add
  https://zulip.com/api/get-events#reaction-remove

Fixes: #5911
  • Loading branch information
chrisbobbe authored and gnprice committed Jan 13, 2025
1 parent 5613a4a commit 7519372
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/api/modelTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,6 @@ export type ReactionType = 'unicode_emoji' | 'realm_emoji' | 'zulip_extra_emoji'

/**
* An emoji reaction to a message.
*
* The raw JSON from the server may have a different structure, but we
* normalize it to this form.
*/
export type Reaction = $ReadOnly<{|
user_id: UserId,
Expand Down
8 changes: 0 additions & 8 deletions src/events/eventToAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,6 @@ export default (state: PerAccountState, event: $FlowFixMe): EventAction | null =
case 'reaction':
return {
...event,

// Raw reaction events from the server have a variation on the
// properties of `Reaction`: instead of `user_id: UserId`, they have
// `user: {| email: string, full_name: string, user_id: UserId |}`.
// NB this is different from the reactions in a `/messages` response;
// see `getMessages` to compare.
user_id: event.user.user_id,

type: opToActionReaction[event.op],
};

Expand Down

0 comments on commit 7519372

Please sign in to comment.