diff --git a/lib/actions/link-actions.js b/lib/actions/link-actions.js --- a/lib/actions/link-actions.js +++ b/lib/actions/link-actions.js @@ -43,6 +43,7 @@ return { status: response.status, community: response.community, + thread: response.thread, }; } return { diff --git a/lib/hooks/invite-links.js b/lib/hooks/invite-links.js --- a/lib/hooks/invite-links.js +++ b/lib/hooks/invite-links.js @@ -134,21 +134,27 @@ export type LinkStatus = 'invalid' | 'valid' | 'timed_out' | 'already_joined'; const inviteLinkTexts: { - +[LinkStatus]: { +header: string, +message: string }, + +[LinkStatus]: { + +header: string, + +message: (isThreadLink: boolean) => string, + }, } = { invalid: { header: 'Invite invalid', - message: + message: () => 'This invite link may be expired. Please try again with another invite' + ' link.', }, ['timed_out']: { header: 'Timeout', - message: 'The request has timed out.', + message: () => 'The request has timed out.', }, ['already_joined']: { header: 'Already a member', - message: 'You are already a member of this community.', + message: isThreadLink => + `You are already a member of this ${ + isThreadLink ? 'thread' : 'community' + }.`, }, }; 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 @@ -86,7 +86,7 @@ {inviteLinkTexts[linkStatus].header} - {inviteLinkTexts[linkStatus].message} + {inviteLinkTexts[linkStatus].message(!!invitationDetails.thread)} ); @@ -101,18 +101,16 @@ const threadInfos = useSelector(threadInfoSelector); const closeModal = React.useCallback(() => { - const communityID = invitationDetails.community?.id; - if ( - linkStatus === 'already_joined' && - communityID && - threadInfos[communityID] - ) { - navigateToThread(threadInfos[communityID]); + const threadID = + invitationDetails.thread?.id ?? invitationDetails.community?.id; + if (linkStatus === 'already_joined' && threadID && threadInfos[threadID]) { + navigateToThread(threadInfos[threadID]); } else { props.navigation.goBack(); } }, [ invitationDetails.community?.id, + invitationDetails.thread?.id, linkStatus, navigateToThread, props.navigation, diff --git a/web/invite-links/accept-invite-modal.react.js b/web/invite-links/accept-invite-modal.react.js --- a/web/invite-links/accept-invite-modal.react.js +++ b/web/invite-links/accept-invite-modal.react.js @@ -92,7 +92,9 @@
{inviteLinkTexts[linkStatus].header}
-
{inviteLinkTexts[linkStatus].message}
+
+ {inviteLinkTexts[linkStatus].message(!!verificationResponse.thread)} +