diff --git a/native/chat/inline-engagement.react.js b/native/chat/inline-engagement.react.js --- a/native/chat/inline-engagement.react.js +++ b/native/chat/inline-engagement.react.js @@ -245,11 +245,7 @@ repliesText, ]); - const sendReaction = useSendReaction( - messageInfo.id, - threadInfo.id, - reactions, - ); + const sendReaction = useSendReaction(messageInfo.id, threadInfo, reactions); const onPressReaction = React.useCallback( (reaction: string) => sendReaction(reaction), diff --git a/native/chat/multimedia-message-tooltip-button.react.js b/native/chat/multimedia-message-tooltip-button.react.js --- a/native/chat/multimedia-message-tooltip-button.react.js +++ b/native/chat/multimedia-message-tooltip-button.react.js @@ -107,11 +107,7 @@ messageInfo, ); - const sendReaction = useSendReaction( - messageInfo.id, - threadInfo.id, - reactions, - ); + const sendReaction = useSendReaction(messageInfo.id, threadInfo, reactions); const [emojiPickerOpen, setEmojiPickerOpen] = React.useState(false); const openEmojiPicker = React.useCallback(() => { diff --git a/native/chat/reaction-message-utils.js b/native/chat/reaction-message-utils.js --- a/native/chat/reaction-message-utils.js +++ b/native/chat/reaction-message-utils.js @@ -11,6 +11,7 @@ import { getNextLocalID } from 'lib/shared/message-utils.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import type { RawReactionMessageInfo } from 'lib/types/messages/reaction.js'; +import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types'; import { cloneError } from 'lib/utils/errors.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -23,7 +24,7 @@ function useSendReaction( messageID: ?string, - threadID: string, + threadInfo: ThreadInfo, reactions: ReactionInfo, ): (reaction: string) => mixed { const viewerID = useSelector( @@ -48,6 +49,8 @@ : false; const action = viewerReacted ? 'remove_reaction' : 'add_reaction'; + const threadID = threadInfo.id; + const reactionMessagePromise = (async () => { try { const result = await callSendReactionMessage({ @@ -103,7 +106,7 @@ messageID, viewerID, reactions, - threadID, + threadInfo.id, dispatchActionPromise, callSendReactionMessage, ], diff --git a/native/chat/robotext-message-tooltip-button.react.js b/native/chat/robotext-message-tooltip-button.react.js --- a/native/chat/robotext-message-tooltip-button.react.js +++ b/native/chat/robotext-message-tooltip-button.react.js @@ -90,11 +90,7 @@ messageInfo, ); - const sendReaction = useSendReaction( - messageInfo.id, - threadInfo.id, - reactions, - ); + const sendReaction = useSendReaction(messageInfo.id, threadInfo, reactions); const [emojiPickerOpen, setEmojiPickerOpen] = React.useState(false); const openEmojiPicker = React.useCallback(() => { diff --git a/native/chat/text-message-tooltip-button.react.js b/native/chat/text-message-tooltip-button.react.js --- a/native/chat/text-message-tooltip-button.react.js +++ b/native/chat/text-message-tooltip-button.react.js @@ -104,11 +104,7 @@ messageInfo, ); - const sendReaction = useSendReaction( - messageInfo.id, - threadInfo.id, - reactions, - ); + const sendReaction = useSendReaction(messageInfo.id, threadInfo, reactions); const [emojiPickerOpen, setEmojiPickerOpen] = React.useState(false); const openEmojiPicker = React.useCallback(() => { diff --git a/web/chat/inline-engagement.react.js b/web/chat/inline-engagement.react.js --- a/web/chat/inline-engagement.react.js +++ b/web/chat/inline-engagement.react.js @@ -87,11 +87,11 @@ key={reaction} reaction={reaction} messageID={messageInfo.id} - threadID={threadInfo.id} + threadInfo={threadInfo} reactions={reactions} /> )); - }, [reactions, messageInfo.id, threadInfo.id]); + }, [reactions, messageInfo.id, threadInfo]); const containerClasses = classNames([ css.inlineEngagementContainer, diff --git a/web/chat/reaction-message-utils.js b/web/chat/reaction-message-utils.js --- a/web/chat/reaction-message-utils.js +++ b/web/chat/reaction-message-utils.js @@ -13,6 +13,7 @@ import { getNextLocalID } from 'lib/shared/message-utils.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import type { RawReactionMessageInfo } from 'lib/types/messages/reaction.js'; +import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { cloneError } from 'lib/utils/errors.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -26,7 +27,7 @@ function useSendReaction( messageID: ?string, - threadID: string, + threadInfo: ThreadInfo, reactions: ReactionInfo, ): (reaction: string) => mixed { const { pushModal } = useModalContext(); @@ -53,6 +54,8 @@ : false; const action = viewerReacted ? 'remove_reaction' : 'add_reaction'; + const threadID = threadInfo.id; + const reactionMessagePromise = (async () => { try { const result = await callSendReactionMessage({ @@ -109,7 +112,7 @@ messageID, viewerID, reactions, - threadID, + threadInfo.id, dispatchActionPromise, callSendReactionMessage, pushModal, diff --git a/web/chat/reaction-pill.react.js b/web/chat/reaction-pill.react.js --- a/web/chat/reaction-pill.react.js +++ b/web/chat/reaction-pill.react.js @@ -4,6 +4,7 @@ import * as React from 'react'; import type { ReactionInfo } from 'lib/selectors/chat-selectors.js'; +import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { useSendReaction } from './reaction-message-utils.js'; import css from './reaction-pill.css'; @@ -18,14 +19,14 @@ type Props = { +reaction: string, +messageID: ?string, - +threadID: string, + +threadInfo: ThreadInfo, +reactions: ReactionInfo, }; function ReactionPill(props: Props): React.Node { - const { reaction, messageID, threadID, reactions } = props; + const { reaction, messageID, threadInfo, reactions } = props; - const sendReaction = useSendReaction(messageID, threadID, reactions); + const sendReaction = useSendReaction(messageID, threadInfo, reactions); const onClickReaction = React.useCallback( (event: SyntheticEvent) => { diff --git a/web/tooltips/message-tooltip.react.js b/web/tooltips/message-tooltip.react.js --- a/web/tooltips/message-tooltip.react.js +++ b/web/tooltips/message-tooltip.react.js @@ -169,11 +169,7 @@ }; }, [emojiKeyboardPosition]); - const sendReaction = useSendReaction( - messageInfo.id, - threadInfo.id, - reactions, - ); + const sendReaction = useSendReaction(messageInfo.id, threadInfo, reactions); const onEmojiSelect = React.useCallback( (emoji: { +native: string, ... }) => {