Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32509070
D6121.1767094973.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6121.1767094973.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
Tue, Dec 30, 11:42 AM (46 m, 56 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5867103
Default Alt Text
D6121.1767094973.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