Page MenuHomePhabricator

D13545.id44726.diff
No OneTemporary

D13545.id44726.diff

diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js
--- a/native/chat/message-list-container.react.js
+++ b/native/chat/message-list-container.react.js
@@ -162,8 +162,6 @@
let searchComponent = null;
if (searching) {
const { userInfoInputArray, genesisThreadInfo } = this.props;
- // It's technically possible for the client to be missing the Genesis
- // ThreadInfo when it first opens up (before the server delivers it)
let parentThreadHeader;
if (threadTypeIsThick(threadInfo.type)) {
parentThreadHeader = (
@@ -175,6 +173,8 @@
/>
);
} else if (genesisThreadInfo) {
+ // It's technically possible for the client to be missing the Genesis
+ // ThreadInfo when it first opens up (before the server delivers it)
parentThreadHeader = (
<ParentThreadHeader
parentThreadInfo={genesisThreadInfo}
@@ -380,13 +380,17 @@
const { editInputMessage } = inputState;
const resolveToUser = React.useCallback(
async (user: AccountUserInfo) => {
- const usersSupportingThickThreads = await checkUsersThickThreadSupport([
- user.id,
- ]);
+ const newUserInfoInputArray = user.id === viewerID ? [] : [user];
+ const usersSupportingThickThreads = await checkUsersThickThreadSupport(
+ newUserInfoInputArray.map(userInfo => userInfo.id),
+ );
const resolvedThreadInfo = existingThreadInfoFinder({
searching: true,
- userInfoInputArray: [user],
- allUsersSupportThickThreads: usersSupportingThickThreads.has(user.id),
+ userInfoInputArray: newUserInfoInputArray,
+ allUsersSupportThickThreads:
+ user.id === viewerID
+ ? true
+ : usersSupportingThickThreads.has(user.id),
});
invariant(
resolvedThreadInfo,
@@ -398,6 +402,7 @@
},
[
checkUsersThickThreadSupport,
+ viewerID,
editInputMessage,
existingThreadInfoFinder,
setParams,
diff --git a/native/chat/message-list-thread-search.react.js b/native/chat/message-list-thread-search.react.js
--- a/native/chat/message-list-thread-search.react.js
+++ b/native/chat/message-list-thread-search.react.js
@@ -9,6 +9,7 @@
import { createTagInput } from '../components/tag-input.react.js';
import UserList from '../components/user-list.react.js';
+import { useSelector } from '../redux/redux-utils.js';
import { useStyles } from '../themes/colors.js';
const TagInput = createTagInput<AccountUserInfo>();
@@ -58,6 +59,7 @@
return [userListItemsArr, nonFriendsSet];
}, [userSearchResults, userInfoInputArray]);
+ const viewerID = useSelector(state => state.currentUserInfo?.id);
const onUserSelect = React.useCallback(
async (userInfo: AccountUserInfo) => {
for (const existingUserInfo of userInfoInputArray) {
@@ -65,7 +67,7 @@
return;
}
}
- if (nonFriends.has(userInfo.id)) {
+ if (nonFriends.has(userInfo.id) || userInfo.id === viewerID) {
await resolveToUser(userInfo);
return;
}
@@ -79,6 +81,7 @@
updateTagInput,
resolveToUser,
updateUsernameInput,
+ viewerID,
],
);
diff --git a/web/chat/chat-thread-composer.react.js b/web/chat/chat-thread-composer.react.js
--- a/web/chat/chat-thread-composer.react.js
+++ b/web/chat/chat-thread-composer.react.js
@@ -97,19 +97,25 @@
async (userListItem: UserListItem) => {
const { alert, notice, disabled, ...user } = userListItem;
setUsernameInputText('');
- if (notice === notFriendNotice && userInfoInputArray.length === 0) {
- const newUserInfoInputArray = [
- { id: userListItem.id, username: userListItem.username },
- ];
+ if (
+ (notice === notFriendNotice || user.id === viewerID) &&
+ userInfoInputArray.length === 0
+ ) {
+ const newUserInfo = {
+ id: userListItem.id,
+ username: userListItem.username,
+ };
+ const newUserInfoInputArray = user.id === viewerID ? [] : [newUserInfo];
const usersSupportingThickThreads = await checkUsersThickThreadSupport(
newUserInfoInputArray.map(userInfo => userInfo.id),
);
const threadInfo = existingThreadInfoFinderForCreatingThread({
searching: true,
userInfoInputArray: newUserInfoInputArray,
- allUsersSupportThickThreads: newUserInfoInputArray.every(userInfo =>
- usersSupportingThickThreads.has(userInfo.id),
- ),
+ allUsersSupportThickThreads:
+ user.id === viewerID
+ ? true
+ : usersSupportingThickThreads.has(user.id),
});
dispatch({
type: updateNavInfoActionType,
@@ -133,6 +139,7 @@
[
checkUsersThickThreadSupport,
dispatch,
+ viewerID,
existingThreadInfoFinderForCreatingThread,
pushModal,
userInfoInputArray,

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 10:32 AM (20 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2544551
Default Alt Text
D13545.id44726.diff (5 KB)

Event Timeline