Page MenuHomePhabricator

D9906.id34192.diff
No OneTemporary

D9906.id34192.diff

diff --git a/native/profile/add-keyserver.react.js b/native/profile/add-keyserver.react.js
--- a/native/profile/add-keyserver.react.js
+++ b/native/profile/add-keyserver.react.js
@@ -16,6 +16,7 @@
import type { NavigationRoute } from '../navigation/route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { useStyles, useColors } from '../themes/colors.js';
+import { useStaffCanSee } from '../utils/staff-utils.js';
type Props = {
+navigation: ProfileNavigationProp<'AddKeyserver'>,
@@ -27,12 +28,17 @@
const dispatch = useDispatch();
+ const staffCanSee = useStaffCanSee();
+
const currentUserID = useSelector(state => state.currentUserInfo?.id);
+ const customServer = useSelector(state => state.customServer);
const { panelForegroundTertiaryLabel } = useColors();
const styles = useStyles(unboundStyles);
- const [urlInput, setUrlInput] = React.useState('');
+ const [urlInput, setUrlInput] = React.useState(
+ customServer && staffCanSee ? customServer : '',
+ );
const [showErrorMessage, setShowErrorMessage] = React.useState(false);
const isKeyserverURLValidCallback = useIsKeyserverURLValid(urlInput);
diff --git a/native/profile/keyserver-selection-bottom-sheet.react.js b/native/profile/keyserver-selection-bottom-sheet.react.js
--- a/native/profile/keyserver-selection-bottom-sheet.react.js
+++ b/native/profile/keyserver-selection-bottom-sheet.react.js
@@ -21,6 +21,8 @@
import { useColors, useStyles } from '../themes/colors.js';
import type { BottomSheetRef } from '../types/bottom-sheet.js';
import Alert from '../utils/alert.js';
+import { useStaffCanSee } from '../utils/staff-utils.js';
+import { setCustomServer } from '../utils/url-utils.js';
export type KeyserverSelectionBottomSheetParams = {
+keyserverAdminUserInfo: GlobalAccountUserInfo,
@@ -96,6 +98,8 @@
);
}, []);
+ const staffCanSee = useStaffCanSee();
+
const dispatch = useDispatch();
const onDeleteKeyserver = React.useCallback(() => {
@@ -106,8 +110,19 @@
},
});
+ if (staffCanSee) {
+ dispatch({
+ type: setCustomServer,
+ payload: keyserverInfo.urlPrefix,
+ });
+ }
bottomSheetRef.current?.close();
- }, [dispatch, keyserverAdminUserInfo.id]);
+ }, [
+ dispatch,
+ keyserverAdminUserInfo.id,
+ keyserverInfo.urlPrefix,
+ staffCanSee,
+ ]);
const onPressRemoveKeyserver = React.useCallback(() => {
Alert.alert(

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 14, 7:19 PM (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2492211
Default Alt Text
D9906.id34192.diff (2 KB)

Event Timeline