Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3495764
D12286.id.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
D12286.id.diff
View Options
diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js
--- a/native/chat/settings/thread-settings.react.js
+++ b/native/chat/settings/thread-settings.react.js
@@ -12,6 +12,10 @@
import { createSelector } from 'reselect';
import tinycolor from 'tinycolor2';
+import {
+ fetchPrimaryInviteLinkActionTypes,
+ useFetchPrimaryInviteLinks,
+} from 'lib/actions/link-actions.js';
import {
changeThreadMemberRolesActionTypes,
changeThreadSettingsActionTypes,
@@ -48,6 +52,7 @@
useResolvedOptionalThreadInfos,
useResolvedThreadInfo,
} from 'lib/utils/entity-helpers.js';
+import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
import ThreadSettingsAvatar from './thread-settings-avatar.react.js';
import type { CategoryType } from './thread-settings-category.react.js';
@@ -1310,9 +1315,24 @@
threadPermissions.DELETE_THREAD,
);
- const { inviteLink, canManageLinks, canAddMembers } =
+ const { inviteLink, canManageLinks, canAddMembers, isCommunityRoot } =
useAddUsersPermissions(threadInfo);
+ const callFetchPrimaryLinks = useFetchPrimaryInviteLinks();
+ const dispatchActionPromise = useDispatchActionPromise();
+ // Because we don't support updates and persistance for invite links,
+ // we have to fetch them whenever we want to display them.
+ // Here we need invite links for the "Add users" button in ThreadSettings
+ React.useEffect(() => {
+ if (!isCommunityRoot) {
+ return;
+ }
+ void dispatchActionPromise(
+ fetchPrimaryInviteLinkActionTypes,
+ callFetchPrimaryLinks(),
+ );
+ }, [callFetchPrimaryLinks, dispatchActionPromise, isCommunityRoot]);
+
return (
<ThreadSettings
{...props}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 9:58 AM (18 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2681380
Default Alt Text
D12286.id.diff (1 KB)
Attached To
Mode
D12286: [native] Fetch invite links when entering thread settings
Attached
Detach File
Event Timeline
Log In to Comment