Page MenuHomePhabricator

D13198.id43767.diff
No OneTemporary

D13198.id43767.diff

diff --git a/native/chat/settings/add-users-modal.react.js b/native/chat/settings/add-users-modal.react.js
--- a/native/chat/settings/add-users-modal.react.js
+++ b/native/chat/settings/add-users-modal.react.js
@@ -11,9 +11,11 @@
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js';
+import { useAddDMThreadMembers } from 'lib/shared/dm-ops/dm-op-utils.js';
import { usePotentialMemberItems } from 'lib/shared/search-utils.js';
import { threadActualMembers } from 'lib/shared/thread-utils.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
+import { threadTypeIsThick } from 'lib/types/thread-types-enum.js';
import { type AccountUserInfo } from 'lib/types/user-types.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
@@ -102,15 +104,29 @@
const inputLength = userInfoInputArray.length;
const dispatchActionPromise = useDispatchActionPromise();
const userInfoInputArrayEmpty = inputLength === 0;
+ const addDMThreadMembers = useAddDMThreadMembers();
+
const onPressAdd = React.useCallback(() => {
if (userInfoInputArrayEmpty) {
return;
}
- void dispatchActionPromise(
- changeThreadSettingsActionTypes,
- addUsersToThread(),
- );
- }, [userInfoInputArrayEmpty, dispatchActionPromise, addUsersToThread]);
+
+ if (threadTypeIsThick(threadInfo.type)) {
+ void addDMThreadMembers(userInfoInputIDs, threadInfo);
+ } else {
+ void dispatchActionPromise(
+ changeThreadSettingsActionTypes,
+ addUsersToThread(),
+ );
+ }
+ }, [
+ userInfoInputArrayEmpty,
+ threadInfo,
+ dispatchActionPromise,
+ addUsersToThread,
+ addDMThreadMembers,
+ userInfoInputIDs,
+ ]);
const changeThreadSettingsLoadingStatus = useSelector(
createLoadingStatusSelector(changeThreadSettingsActionTypes),

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 10:01 PM (20 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577200
Default Alt Text
D13198.id43767.diff (2 KB)

Event Timeline