Page MenuHomePhabricator

D12420.id41281.diff
No OneTemporary

D12420.id41281.diff

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}
</Text>
<Text style={styles.invalidInviteExplanation}>
- {inviteLinkTexts[linkStatus].message}
+ {inviteLinkTexts[linkStatus].message(!!invitationDetails.thread)}
</Text>
</>
);
@@ -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 @@
<div className={css.heading}>
{inviteLinkTexts[linkStatus].header}
</div>
- <div className={css.text}>{inviteLinkTexts[linkStatus].message}</div>
+ <div className={css.text}>
+ {inviteLinkTexts[linkStatus].message(!!verificationResponse.thread)}
+ </div>
</div>
<hr />
<Button
diff --git a/web/invite-links/invite-link-handler.react.js b/web/invite-links/invite-link-handler.react.js
--- a/web/invite-links/invite-link-handler.react.js
+++ b/web/invite-links/invite-link-handler.react.js
@@ -86,17 +86,17 @@
};
}
- const communityID = result.community?.id;
+ const threadID = result.thread?.id ?? result.community?.id;
if (
- communityID &&
+ threadID &&
result.status === 'already_joined' &&
- threadInfos[communityID]
+ threadInfos[threadID]
) {
dispatch({
type: updateNavInfoActionType,
payload: {
chatMode: 'view',
- activeChatThreadID: communityID,
+ activeChatThreadID: threadID,
tab: 'chat',
},
});

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 8:51 AM (22 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596259
Default Alt Text
D12420.id41281.diff (3 KB)

Event Timeline