Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3249514
D6801.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D6801.diff
View Options
diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js
--- a/native/chat/chat-input-bar.react.js
+++ b/native/chat/chat-input-bar.react.js
@@ -28,6 +28,7 @@
newThreadActionTypes,
} from 'lib/actions/thread-actions.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import {
relativeMemberInfoSelectorForMembersOfThread,
userStoreSearchIndex,
@@ -120,7 +121,6 @@
};
type Props = {
...BaseProps,
- // Redux state
+viewerID: ?string,
+draft: string,
+joinThreadLoadingStatus: LoadingStatus,
@@ -132,19 +132,15 @@
+styles: typeof unboundStyles,
+onInputBarLayout?: (event: LayoutEvent) => mixed,
+openCamera: () => mixed,
- // connectNav
+isActive: boolean,
- // withKeyboardState
+keyboardState: ?KeyboardState,
- // Redux dispatch functions
+dispatch: Dispatch,
+dispatchActionPromise: DispatchActionPromise,
- // async functions that hit server APIs
+joinThread: (request: ClientThreadJoinRequest) => Promise<ThreadJoinPayload>,
- // withInputState
+inputState: ?InputState,
+userSearchIndex: SearchIndex,
+threadMembers: $ReadOnlyArray<RelativeMemberInfo>,
+ +parentThreadInfo: ?ThreadInfo,
};
type State = {
+text: string,
@@ -738,6 +734,7 @@
time: Date.now(),
},
this.props.threadInfo,
+ this.props.parentThreadInfo,
);
};
@@ -946,6 +943,11 @@
relativeMemberInfoSelectorForMembersOfThread(props.threadInfo.id),
);
+ const { parentThreadID } = props.threadInfo;
+ const parentThreadInfo = useSelector(state =>
+ parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
+ );
+
return (
<ChatInputBar
{...props}
@@ -966,6 +968,7 @@
inputState={inputState}
userSearchIndex={userSearchIndex}
threadMembers={threadMembers}
+ parentThreadInfo={parentThreadInfo}
/>
);
}
diff --git a/native/chat/failed-send.react.js b/native/chat/failed-send.react.js
--- a/native/chat/failed-send.react.js
+++ b/native/chat/failed-send.react.js
@@ -4,12 +4,14 @@
import * as React from 'react';
import { Text, View } from 'react-native';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { messageID } from 'lib/shared/message-utils.js';
import {
assertComposableRawMessage,
messageTypes,
} from 'lib/types/message-types.js';
import type { RawComposableMessageInfo } from 'lib/types/message-types.js';
+import type { ThreadInfo } from 'lib/types/thread-types.js';
import { multimediaMessageSendFailed } from './multimedia-message-utils.js';
import textMessageSendFailed from './text-message-send-failed.js';
@@ -26,11 +28,10 @@
};
type Props = {
...BaseProps,
- // Redux state
+rawMessageInfo: ?RawComposableMessageInfo,
+styles: typeof unboundStyles,
- // withInputState
+inputState: ?InputState,
+ +parentThreadInfo: ?ThreadInfo,
};
class FailedSend extends React.PureComponent<Props> {
retryingText = false;
@@ -126,7 +127,11 @@
);
const { localID } = rawMessageInfo;
invariant(localID, 'failed RawMessageInfo should have localID');
- inputState.retryMessage(localID, this.props.item.threadInfo);
+ inputState.retryMessage(
+ localID,
+ this.props.item.threadInfo,
+ this.props.parentThreadInfo,
+ );
};
}
@@ -156,12 +161,17 @@
});
const styles = useStyles(unboundStyles);
const inputState = React.useContext(InputStateContext);
+ const { parentThreadID } = props.item.threadInfo;
+ const parentThreadInfo = useSelector(state =>
+ parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
+ );
return (
<FailedSend
{...props}
rawMessageInfo={rawMessageInfo}
styles={styles}
inputState={inputState}
+ parentThreadInfo={parentThreadInfo}
/>
);
});
diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -400,6 +400,7 @@
sendTextMessage = async (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
) => {
this.sendCallbacks.forEach(callback => callback());
@@ -415,7 +416,7 @@
if (!threadIsPending(threadInfo.id)) {
this.props.dispatchActionPromise(
sendTextMessageActionTypes,
- this.sendTextMessageAction(messageInfo),
+ this.sendTextMessageAction(messageInfo, threadInfo, parentThreadInfo),
undefined,
messageInfo,
);
@@ -449,9 +450,17 @@
threadID: newThreadID,
time: Date.now(),
};
+ const newThreadInfo = {
+ ...threadInfo,
+ id: newThreadID,
+ };
this.props.dispatchActionPromise(
sendTextMessageActionTypes,
- this.sendTextMessageAction(newMessageInfo),
+ this.sendTextMessageAction(
+ newMessageInfo,
+ newThreadInfo,
+ parentThreadInfo,
+ ),
undefined,
newMessageInfo,
);
@@ -479,6 +488,10 @@
async sendTextMessageAction(
messageInfo: RawTextMessageInfo,
+ // eslint-disable-next-line no-unused-vars
+ threadInfo: ThreadInfo,
+ // eslint-disable-next-line no-unused-vars
+ parentThreadInfo: ?ThreadInfo,
): Promise<SendMessagePayload> {
try {
const { localID } = messageInfo;
@@ -1082,6 +1095,7 @@
retryTextMessage = async (
rawMessageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
) => {
await this.sendTextMessage(
{
@@ -1089,6 +1103,7 @@
time: Date.now(),
},
threadInfo,
+ parentThreadInfo,
);
};
@@ -1302,12 +1317,16 @@
await this.uploadFiles(localMessageID, uploadFileInputs);
};
- retryMessage = async (localMessageID: string, threadInfo: ThreadInfo) => {
+ retryMessage = async (
+ localMessageID: string,
+ threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
+ ) => {
const rawMessageInfo = this.props.messageStoreMessages[localMessageID];
invariant(rawMessageInfo, `rawMessageInfo ${localMessageID} should exist`);
if (rawMessageInfo.type === messageTypes.TEXT) {
- await this.retryTextMessage(rawMessageInfo, threadInfo);
+ await this.retryTextMessage(rawMessageInfo, threadInfo, parentThreadInfo);
} else if (
rawMessageInfo.type === messageTypes.IMAGES ||
rawMessageInfo.type === messageTypes.MULTIMEDIA
diff --git a/native/input/input-state.js b/native/input/input-state.js
--- a/native/input/input-state.js
+++ b/native/input/input-state.js
@@ -27,6 +27,7 @@
+sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
) => Promise<void>,
+sendMultimediaMessage: (
selections: $ReadOnlyArray<NativeMediaSelection>,
@@ -39,6 +40,7 @@
+retryMessage: (
localMessageID: string,
threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
) => Promise<void>,
+registerSendCallback: (() => void) => void,
+unregisterSendCallback: (() => void) => void,
diff --git a/web/chat/chat-input-bar.react.js b/web/chat/chat-input-bar.react.js
--- a/web/chat/chat-input-bar.react.js
+++ b/web/chat/chat-input-bar.react.js
@@ -11,6 +11,7 @@
} from 'lib/actions/thread-actions.js';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import {
userStoreSearchIndex,
relativeMemberInfoSelectorForMembersOfThread,
@@ -65,7 +66,6 @@
};
type Props = {
...BaseProps,
- // Redux state
+viewerID: ?string,
+joinThreadLoadingStatus: LoadingStatus,
+threadCreationInProgress: boolean,
@@ -73,12 +73,11 @@
+nextLocalID: number,
+isThreadActive: boolean,
+userInfos: UserInfos,
- // Redux dispatch functions
+dispatchActionPromise: DispatchActionPromise,
- // async functions that hit server APIs
+joinThread: (request: ClientThreadJoinRequest) => Promise<ThreadJoinPayload>,
+typeaheadMatchedStrings: ?TypeaheadMatchedStrings,
+suggestedUsers: $ReadOnlyArray<RelativeMemberInfo>,
+ +parentThreadInfo: ?ThreadInfo,
};
class ChatInputBar extends React.PureComponent<Props> {
@@ -478,6 +477,7 @@
time: Date.now(),
},
this.props.threadInfo,
+ this.props.parentThreadInfo,
);
}
@@ -609,6 +609,11 @@
typeaheadMatchedStrings,
]);
+ const { parentThreadID } = props.threadInfo;
+ const parentThreadInfo = useSelector(state =>
+ parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
+ );
+
return (
<ChatInputBar
{...props}
@@ -623,6 +628,7 @@
joinThread={callJoinThread}
typeaheadMatchedStrings={typeaheadMatchedStrings}
suggestedUsers={suggestedUsers}
+ parentThreadInfo={parentThreadInfo}
/>
);
});
diff --git a/web/chat/failed-send.react.js b/web/chat/failed-send.react.js
--- a/web/chat/failed-send.react.js
+++ b/web/chat/failed-send.react.js
@@ -4,6 +4,7 @@
import * as React from 'react';
import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { messageID } from 'lib/shared/message-utils.js';
import {
messageTypes,
@@ -25,10 +26,9 @@
};
type Props = {
...BaseProps,
- // Redux state
+rawMessageInfo: RawComposableMessageInfo,
- // withInputState
+inputState: ?InputState,
+ +parentThreadInfo: ?ThreadInfo,
};
class FailedSend extends React.PureComponent<Props> {
retryingText = false;
@@ -112,6 +112,7 @@
time: Date.now(),
},
this.props.threadInfo,
+ this.props.parentThreadInfo,
);
} else if (
rawMessageInfo.type === messageTypes.IMAGES ||
@@ -144,11 +145,16 @@
'FailedSend should only be used for composable message types',
);
const inputState = React.useContext(InputStateContext);
+ const { parentThreadID } = props.threadInfo;
+ const parentThreadInfo = useSelector(state =>
+ parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
+ );
return (
<FailedSend
{...props}
rawMessageInfo={rawMessageInfo}
inputState={inputState}
+ parentThreadInfo={parentThreadInfo}
/>
);
});
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -525,7 +525,8 @@
sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
- ) => this.sendTextMessage(messageInfo, threadInfo),
+ parentThreadInfo: ?ThreadInfo,
+ ) => this.sendTextMessage(messageInfo, threadInfo, parentThreadInfo),
createMultimediaMessage: (localID: number, threadInfo: ThreadInfo) =>
this.createMultimediaMessage(localID, threadInfo),
setDraft: (newDraft: string) => this.setDraft(threadID, newDraft),
@@ -999,6 +1000,7 @@
async sendTextMessage(
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
) {
this.props.sendCallbacks.forEach(callback => callback());
@@ -1014,7 +1016,7 @@
if (!threadIsPending(threadInfo.id)) {
this.props.dispatchActionPromise(
sendTextMessageActionTypes,
- this.sendTextMessageAction(messageInfo),
+ this.sendTextMessageAction(messageInfo, threadInfo, parentThreadInfo),
undefined,
messageInfo,
);
@@ -1048,9 +1050,17 @@
threadID: newThreadID,
time: Date.now(),
};
+ const newThreadInfo = {
+ ...threadInfo,
+ id: newThreadID,
+ };
this.props.dispatchActionPromise(
sendTextMessageActionTypes,
- this.sendTextMessageAction(newMessageInfo),
+ this.sendTextMessageAction(
+ newMessageInfo,
+ newThreadInfo,
+ parentThreadInfo,
+ ),
undefined,
newMessageInfo,
);
@@ -1058,6 +1068,10 @@
async sendTextMessageAction(
messageInfo: RawTextMessageInfo,
+ // eslint-disable-next-line no-unused-vars
+ threadInfo: ThreadInfo,
+ // eslint-disable-next-line no-unused-vars
+ parentThreadInfo: ?ThreadInfo,
): Promise<SendMessagePayload> {
try {
const { localID } = messageInfo;
diff --git a/web/input/input-state.js b/web/input/input-state.js
--- a/web/input/input-state.js
+++ b/web/input/input-state.js
@@ -58,6 +58,7 @@
+sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
) => Promise<void>,
+createMultimediaMessage: (localID: number, threadInfo: ThreadInfo) => void,
+setDraft: (draft: string) => void,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 3:41 PM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2498140
Default Alt Text
D6801.diff (12 KB)
Attached To
Mode
D6801: [native][web] Drill parentThreadInfo to InputState.sendTextMessageAction
Attached
Detach File
Event Timeline
Log In to Comment