From f24cc473ec1f42eb94dbb7684a4629a83d479871 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Fri, 10 Jan 2025 16:28:13 -0800 Subject: [PATCH] api: On reaction events, stop assuming old `user` object is present 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 --- src/api/modelTypes.js | 3 --- src/events/eventToAction.js | 8 -------- 2 files changed, 11 deletions(-) diff --git a/src/api/modelTypes.js b/src/api/modelTypes.js index 385c157c529..17404c0add0 100644 --- a/src/api/modelTypes.js +++ b/src/api/modelTypes.js @@ -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, diff --git a/src/events/eventToAction.js b/src/events/eventToAction.js index 44cabd466d7..994205493e6 100644 --- a/src/events/eventToAction.js +++ b/src/events/eventToAction.js @@ -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], };