diff --git a/lib/utils/url-utils.js b/lib/utils/url-utils.js --- a/lib/utils/url-utils.js +++ b/lib/utils/url-utils.js @@ -12,6 +12,7 @@ +settings?: 'account' | 'danger-zone', +threadCreation?: boolean, +selectedUserList?: $ReadOnlyArray, + +inviteSecret?: string, ... }; @@ -33,6 +34,10 @@ '(/|^)thread/new(/([0-9]+([+][0-9]+)*))?(/|$)', 'i', ); +const inviteLinkRegex = new RegExp( + '(/|^)handle/invite/([a-zA-Z0-9]+)(/|$)', + 'i', +); function infoFromURL(url: string): URLInfo { const yearMatches = yearRegex.exec(url); @@ -45,6 +50,7 @@ const dangerZoneTest = dangerZoneRegex.test(url); const threadPendingMatches = threadPendingRegex.exec(url); const threadCreateMatches = threadCreationRegex.exec(url); + const inviteLinkMatches = inviteLinkRegex.exec(url); const returnObj = {}; if (yearMatches) { @@ -70,6 +76,9 @@ if (verifyMatches) { returnObj.verify = verifyMatches[2]; } + if (inviteLinkMatches) { + returnObj.inviteSecret = inviteLinkMatches[2]; + } if (calendarTest) { returnObj.calendar = true; } else if (chatTest) { diff --git a/web/types/nav-types.js b/web/types/nav-types.js --- a/web/types/nav-types.js +++ b/web/types/nav-types.js @@ -29,6 +29,7 @@ +settingsSection?: NavigationSettingsSection, +selectedUserList?: $ReadOnlyArray, +chatMode?: NavigationChatMode, + +inviteSecret?: ?string, }; export const navInfoValidator: TInterface = tShape<$Exact>({ @@ -40,4 +41,5 @@ settingsSection: t.maybe(navigationSettingsSectionValidator), selectedUserList: t.maybe(t.list(t.String)), chatMode: t.maybe(navigationChatModeValidator), + inviteSecret: t.maybe(t.String), }); diff --git a/web/url-utils.js b/web/url-utils.js --- a/web/url-utils.js +++ b/web/url-utils.js @@ -133,6 +133,10 @@ newNavInfo.settingsSection = urlInfo.settings; } + if (urlInfo.inviteSecret) { + newNavInfo.inviteSecret = urlInfo.inviteSecret; + } + return newNavInfo; }