Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3375323
D12317.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12317.diff
View Options
diff --git a/native/navigation/invite-link-modal.react.js b/native/navigation/invite-link-modal.react.js
--- a/native/navigation/invite-link-modal.react.js
+++ b/native/navigation/invite-link-modal.react.js
@@ -8,6 +8,7 @@
useAcceptInviteLink,
} from 'lib/hooks/invite-links.js';
import type { LinkStatus } from 'lib/hooks/invite-links.js';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import type { KeyserverOverride } from 'lib/shared/invite-links';
import type { InviteLinkVerificationResponse } from 'lib/types/link-types.js';
@@ -15,6 +16,7 @@
import { NavContext } from './navigation-context.js';
import type { RootNavigationProp } from './root-navigator.react.js';
import type { NavigationRoute } from './route-names.js';
+import { useNavigateToThread } from '../chat/message-list-types.js';
import Button from '../components/button.react.js';
import Modal from '../components/modal.react.js';
import { useSelector } from '../redux/redux-utils.js';
@@ -87,6 +89,27 @@
linkStatus,
]);
+ const threadInfos = useSelector(threadInfoSelector);
+ const navigateToThread = useNavigateToThread();
+ const closeModal = React.useCallback(() => {
+ const communityID = invitationDetails.community?.id;
+ if (
+ linkStatus === 'already_joined' &&
+ communityID &&
+ threadInfos[communityID]
+ ) {
+ navigateToThread({ threadInfo: threadInfos[communityID] });
+ } else {
+ props.navigation.goBack();
+ }
+ }, [
+ invitationDetails.community?.id,
+ linkStatus,
+ navigateToThread,
+ props.navigation,
+ threadInfos,
+ ]);
+
const buttons = React.useMemo(() => {
if (linkStatus === 'valid') {
const joinButtonContent =
@@ -120,15 +143,16 @@
return (
<Button
style={[styles.button, styles.buttonPrimary]}
- onPress={props.navigation.goBack}
+ onPress={closeModal}
>
<Text style={styles.buttonText}>Return to Comm</Text>
</Button>
);
}, [
- linkStatus,
+ closeModal,
joinCommunity,
joinThreadLoadingStatus,
+ linkStatus,
props.navigation.goBack,
styles.activityIndicatorStyle,
styles.button,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 7:41 PM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591478
Default Alt Text
D12317.diff (2 KB)
Attached To
Mode
D12317: [native] Open a community when a user clicks an invite link and is already a member
Attached
Detach File
Event Timeline
Log In to Comment