Page MenuHomePhabricator

D13199.diff
No OneTemporary

D13199.diff

diff --git a/web/modals/threads/members/add-members-modal.react.js b/web/modals/threads/members/add-members-modal.react.js
--- a/web/modals/threads/members/add-members-modal.react.js
+++ b/web/modals/threads/members/add-members-modal.react.js
@@ -6,7 +6,11 @@
changeThreadSettingsActionTypes,
useChangeThreadSettings,
} from 'lib/actions/thread-actions.js';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
+import { useAddDMThreadMembers } from 'lib/shared/dm-ops/dm-op-utils.js';
+import { threadTypeIsThick } from 'lib/types/thread-types-enum.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
+import { useSelector } from 'lib/utils/redux-utils.js';
import css from './members-modal.css';
import Button from '../../../components/button.react.js';
@@ -59,22 +63,32 @@
const dispatchActionPromise = useDispatchActionPromise();
const callChangeThreadSettings = useChangeThreadSettings();
+ const addDMThreadMembers = useAddDMThreadMembers();
+ const threadInfo = useSelector(state => threadInfoSelector(state)[threadID]);
const addUsers = React.useCallback(() => {
- void dispatchActionPromise(
- changeThreadSettingsActionTypes,
- callChangeThreadSettings({
- threadID,
- changes: { newMemberIDs: Array.from(pendingUsersToAdd.keys()) },
- }),
- );
+ const newMemberIDs = Array.from(pendingUsersToAdd.keys());
+
+ if (threadTypeIsThick(threadInfo.type)) {
+ void addDMThreadMembers(newMemberIDs, threadInfo);
+ } else {
+ void dispatchActionPromise(
+ changeThreadSettingsActionTypes,
+ callChangeThreadSettings({
+ threadID,
+ changes: { newMemberIDs },
+ }),
+ );
+ }
onClose();
}, [
+ addDMThreadMembers,
callChangeThreadSettings,
dispatchActionPromise,
onClose,
pendingUsersToAdd,
threadID,
+ threadInfo,
]);
const primaryButton = React.useMemo(

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 12:38 PM (21 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2593998
Default Alt Text
D13199.diff (1 KB)

Event Timeline