Page MenuHomePhabricator

D6401.diff
No OneTemporary

D6401.diff

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
@@ -23,9 +23,7 @@
messageID: ?string,
localID: string,
threadID: string,
- reaction: string,
- action: 'add_reaction' | 'remove_reaction',
-): (event: SyntheticEvent<HTMLElement>) => mixed {
+): (reaction: string, action: 'add_reaction' | 'remove_reaction') => mixed {
const { pushModal } = useModalContext();
const viewerID = useSelector(
@@ -36,9 +34,7 @@
const dispatchActionPromise = useDispatchActionPromise();
return React.useCallback(
- (event: SyntheticEvent<HTMLElement>) => {
- event.preventDefault();
-
+ (reaction, action) => {
if (!messageID) {
return;
}
@@ -95,11 +91,9 @@
},
[
messageID,
+ viewerID,
threadID,
localID,
- viewerID,
- reaction,
- action,
dispatchActionPromise,
callSendReactionMessage,
pushModal,
diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js
--- a/web/utils/tooltip-utils.js
+++ b/web/utils/tooltip-utils.js
@@ -466,13 +466,12 @@
const viewerReacted = !!reactions.get(reactionInput)?.viewerReacted;
const action = viewerReacted ? 'remove_reaction' : 'add_reaction';
- const onClickReact = useOnClickReact(
- messageInfo.id,
- localID,
- threadInfo.id,
- reactionInput,
+ const onClickReact = useOnClickReact(messageInfo.id, localID, threadInfo.id);
+
+ const onClick = React.useCallback(() => onClickReact(reactionInput, action), [
action,
- );
+ onClickReact,
+ ]);
const canCreateReactionFromMessage = useCanCreateReactionFromMessage(
threadInfo,
@@ -490,10 +489,10 @@
return {
actionButtonContent: buttonContent,
- onClick: onClickReact,
+ onClick,
label: viewerReacted ? 'Unlike' : 'Like',
};
- }, [canCreateReactionFromMessage, onClickReact, viewerReacted]);
+ }, [canCreateReactionFromMessage, onClick, viewerReacted]);
}
function useMessageTooltipActions(

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 3:23 PM (11 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678475
Default Alt Text
D6401.diff (2 KB)

Event Timeline