Page MenuHomePhabricator

D6121.id20459.diff
No OneTemporary

D6121.id20459.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,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

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)

Event Timeline