Page MenuHomePhabricator

D6121.id20716.diff
No OneTemporary

D6121.id20716.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
@@ -1,5 +1,6 @@
// @flow
+import invariant from 'invariant';
import * as React from 'react';
import {
@@ -7,12 +8,15 @@
sendReactionMessageActionTypes,
} from 'lib/actions/message-actions';
import { useModalContext } from 'lib/components/modal-provider.react';
+import { messageTypes } from 'lib/types/message-types';
+import type { RawReactionMessageInfo } from 'lib/types/messages/reaction';
import {
useDispatchActionPromise,
useServerCall,
} from 'lib/utils/action-utils';
import Alert from '../modals/alert.react';
+import { useSelector } from '../redux/redux-utils';
function useOnClickReact(
messageID: ?string,
@@ -23,6 +27,10 @@
): (event: SyntheticEvent<HTMLElement>) => mixed {
const { pushModal } = useModalContext();
+ const viewerID = useSelector(
+ state => state.currentUserInfo && state.currentUserInfo.id,
+ );
+
const callSendReactionMessage = useServerCall(sendReactionMessage);
const dispatchActionPromise = useDispatchActionPromise();
@@ -34,6 +42,8 @@
return;
}
+ invariant(viewerID, 'viewerID should be set');
+
const reactionMessagePromise = (async () => {
try {
const result = await callSendReactionMessage({
@@ -59,20 +69,34 @@
}
})();
+ const startingPayload: RawReactionMessageInfo = {
+ type: messageTypes.REACTION,
+ threadID,
+ localID,
+ creatorID: viewerID,
+ time: Date.now(),
+ targetMessageID: messageID,
+ reaction,
+ action,
+ };
+
dispatchActionPromise(
sendReactionMessageActionTypes,
reactionMessagePromise,
+ undefined,
+ startingPayload,
);
},
[
- action,
- callSendReactionMessage,
- dispatchActionPromise,
messageID,
- pushModal,
- reaction,
threadID,
localID,
+ viewerID,
+ reaction,
+ action,
+ dispatchActionPromise,
+ callSendReactionMessage,
+ pushModal,
],
);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 9:25 AM (18 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590021
Default Alt Text
D6121.id20716.diff (2 KB)

Event Timeline