Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3373387
D6121.id20716.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6121.id20716.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6121: [web] add starting payload to send reaction message dispatch action promise
Attached
Detach File
Event Timeline
Log In to Comment