Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3406219
D7949.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
D7949.diff
View Options
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<string>,
+ +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<string>,
+chatMode?: NavigationChatMode,
+ +inviteSecret?: ?string,
};
export const navInfoValidator: TInterface<NavInfo> = tShape<$Exact<NavInfo>>({
@@ -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;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 5, 1:12 AM (5 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615387
Default Alt Text
D7949.diff (1 KB)
Attached To
Mode
D7949: [web] Parse invite link secret
Attached
Detach File
Event Timeline
Log In to Comment