Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3378716
D13199.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13199.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13199: [web] implement adding thread members in `AddUsersModal`
Attached
Detach File
Event Timeline
Log In to Comment