Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3183724
D9887.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D9887.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
@@ -16,7 +16,7 @@
+calendar?: boolean,
+chat?: boolean,
+thread?: string,
- +settings?: 'account' | 'danger-zone',
+ +settings?: 'account' | 'keyservers' | 'danger-zone',
+threadCreation?: boolean,
+selectedUserList?: $ReadOnlyArray<string>,
+inviteSecret?: string,
@@ -31,7 +31,7 @@
calendar: t.maybe(t.Boolean),
chat: t.maybe(t.Boolean),
thread: t.maybe(tID),
- settings: t.maybe(t.enums.of(['account', 'danger-zone'])),
+ settings: t.maybe(t.enums.of(['account', 'keyservers', 'danger-zone'])),
threadCreation: t.maybe(t.Boolean),
selectedUserList: t.maybe(t.list(t.String)),
inviteSecret: t.maybe(t.String),
@@ -47,6 +47,7 @@
const calendarRegex = new RegExp('(/|^)calendar(/|$)', 'i');
const chatRegex = new RegExp('(/|^)chat(/|$)', 'i');
const accountSettingsRegex = new RegExp('(/|^)settings/account(/|$)', 'i');
+const keyserversRegex = new RegExp('(/|^)settings/keyservers(/|$)', 'i');
const dangerZoneRegex = new RegExp('(/|^)settings/danger-zone(/|$)', 'i');
const threadPendingRegex = new RegExp(
`(/|^)thread/(${pendingThreadIDRegex})(/|$)`,
@@ -70,6 +71,7 @@
const calendarTest = calendarRegex.test(url);
const chatTest = chatRegex.test(url);
const accountSettingsTest = accountSettingsRegex.test(url);
+ const keyserversSettingsTest = keyserversRegex.test(url);
const dangerZoneTest = dangerZoneRegex.test(url);
const threadPendingMatches = threadPendingRegex.exec(url);
const threadCreateMatches = threadCreationRegex.exec(url);
@@ -109,6 +111,8 @@
returnObj.chat = true;
} else if (accountSettingsTest) {
returnObj.settings = 'account';
+ } else if (keyserversSettingsTest) {
+ returnObj.settings = 'keyservers';
} else if (dangerZoneTest) {
returnObj.settings = 'danger-zone';
} else if (qrCodeLoginMatches) {
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -291,6 +291,8 @@
if (tab === 'settings') {
if (settingsSection === 'account') {
mainContent = <AccountSettings />;
+ } else if (settingsSection === 'keyservers') {
+ mainContent = null;
} else if (settingsSection === 'danger-zone') {
mainContent = <DangerZone />;
}
diff --git a/web/navigation-panels/settings-switcher.react.js b/web/navigation-panels/settings-switcher.react.js
--- a/web/navigation-panels/settings-switcher.react.js
+++ b/web/navigation-panels/settings-switcher.react.js
@@ -7,6 +7,7 @@
import css from './settings-switcher.css';
import { updateNavInfoActionType } from '../redux/action-types.js';
import { navSettingsSectionSelector } from '../selectors/nav-selectors.js';
+import { useStaffCanSee } from '../utils/staff-utils.js';
function SettingsSwitcher(): React.Node {
const dispatch = useDispatch();
@@ -30,6 +31,30 @@
[onClickAccountSettings],
);
+ const staffCanSee = useStaffCanSee();
+
+ const onClickKeyservers = React.useCallback(
+ (event: SyntheticEvent<HTMLAnchorElement>) => {
+ event.preventDefault();
+ dispatch({
+ type: updateNavInfoActionType,
+ payload: { tab: 'settings', settingsSection: 'keyservers' },
+ });
+ },
+ [dispatch],
+ );
+
+ const keyserversNavigationItem = React.useMemo(() => {
+ if (!staffCanSee) {
+ return null;
+ }
+ return (
+ <a className={css.navigationPanelTab} onClick={onClickKeyservers}>
+ <p>Keyservers</p>
+ </a>
+ );
+ }, [onClickKeyservers, staffCanSee]);
+
const onClickDangerZone = React.useCallback(
(event: SyntheticEvent<HTMLAnchorElement>) => {
event.preventDefault();
@@ -54,6 +79,9 @@
<NavigationPanel.Item tab="account">
{accountSettingsNavigationItem}
</NavigationPanel.Item>
+ <NavigationPanel.Item tab="keyservers">
+ {keyserversNavigationItem}
+ </NavigationPanel.Item>
<NavigationPanel.Item tab="danger-zone">
{dangerZoneNavigationItem}
</NavigationPanel.Item>
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
@@ -18,9 +18,13 @@
export type LoginMethod = 'form' | 'qr-code';
const loginMethodValidator = t.enums.of(['form', 'qr-code']);
-export type NavigationSettingsSection = 'account' | 'danger-zone';
+export type NavigationSettingsSection =
+ | 'account'
+ | 'keyservers'
+ | 'danger-zone';
const navigationSettingsSectionValidator = t.enums.of([
'account',
+ 'keyservers',
'danger-zone',
]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 9:56 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2451284
Default Alt Text
D9887.diff (4 KB)
Attached To
Mode
D9887: [web] introduce keyservers to the settings switcher
Attached
Detach File
Event Timeline
Log In to Comment