Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3384902
D6121.id20459.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6121.id20459.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,11 @@
): (event: SyntheticEvent<HTMLElement>) => mixed {
const { pushModal } = useModalContext();
+ const viewerID = useSelector(
+ state => state.currentUserInfo && state.currentUserInfo.id,
+ );
+ invariant(viewerID, 'viewerID should be set');
+
const callSendReactionMessage = useServerCall(sendReactionMessage);
const dispatchActionPromise = useDispatchActionPromise();
@@ -59,20 +68,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
Fri, Nov 29, 10:37 PM (4 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598449
Default Alt Text
D6121.id20459.diff (1 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