Page MenuHomePhabricator

D9193.diff
No OneTemporary

D9193.diff

diff --git a/lib/shared/staff-utils.js b/lib/shared/staff-utils.js
--- a/lib/shared/staff-utils.js
+++ b/lib/shared/staff-utils.js
@@ -2,6 +2,7 @@
import bots from '../facts/bots.js';
import staff from '../facts/staff.js';
+import { useSelector } from '../utils/redux-utils.js';
function isStaff(userID: string): boolean {
if (staff.includes(userID)) {
@@ -16,4 +17,11 @@
return false;
}
-export { isStaff };
+function useIsCurrentUserStaff(): boolean {
+ const isCurrentUserStaff = useSelector(state =>
+ state.currentUserInfo?.id ? isStaff(state.currentUserInfo.id) : false,
+ );
+ return isCurrentUserStaff;
+}
+
+export { isStaff, useIsCurrentUserStaff };
diff --git a/native/components/feature-flags-provider.react.js b/native/components/feature-flags-provider.react.js
--- a/native/components/feature-flags-provider.react.js
+++ b/native/components/feature-flags-provider.react.js
@@ -4,9 +4,9 @@
import * as React from 'react';
import { Platform } from 'react-native';
+import { useIsCurrentUserStaff } from 'lib/shared/staff-utils.js';
import { fetchFeatureFlags } from 'lib/utils/feature-flags-utils.js';
import sleep from 'lib/utils/sleep.js';
-import { useIsCurrentUserStaff } from 'native/utils/staff-utils.js';
import { codeVersion } from '../redux/persist.js';
diff --git a/native/profile/build-info.react.js b/native/profile/build-info.react.js
--- a/native/profile/build-info.react.js
+++ b/native/profile/build-info.react.js
@@ -4,14 +4,12 @@
import { View, Text } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
+import { useIsCurrentUserStaff } from 'lib/shared/staff-utils.js';
+
import { persistConfig, codeVersion } from '../redux/persist.js';
import { StaffContext } from '../staff/staff-context.js';
import { useStyles } from '../themes/colors.js';
-import {
- isStaffRelease,
- useIsCurrentUserStaff,
- useStaffCanSee,
-} from '../utils/staff-utils.js';
+import { isStaffRelease, useStaffCanSee } from '../utils/staff-utils.js';
// eslint-disable-next-line no-unused-vars
function BuildInfo(props: { ... }): React.Node {
diff --git a/native/staff/staff-context.provider.react.js b/native/staff/staff-context.provider.react.js
--- a/native/staff/staff-context.provider.react.js
+++ b/native/staff/staff-context.provider.react.js
@@ -2,8 +2,9 @@
import * as React from 'react';
+import { useIsCurrentUserStaff } from 'lib/shared/staff-utils.js';
+
import { StaffContext, type StaffContextType } from './staff-context.js';
-import { useIsCurrentUserStaff } from '../utils/staff-utils.js';
type Props = {
+children: React.Node,
diff --git a/native/utils/staff-utils.js b/native/utils/staff-utils.js
--- a/native/utils/staff-utils.js
+++ b/native/utils/staff-utils.js
@@ -1,21 +1,12 @@
// @flow
-import { isStaff } from 'lib/shared/staff-utils.js';
-
-import { useSelector } from '../redux/redux-utils.js';
+import { useIsCurrentUserStaff } from 'lib/shared/staff-utils.js';
const isStaffRelease = false;
-function useIsCurrentUserStaff(): boolean {
- const isCurrentUserStaff = useSelector(state =>
- state.currentUserInfo?.id ? isStaff(state.currentUserInfo.id) : false,
- );
- return isCurrentUserStaff;
-}
-
function useStaffCanSee(): boolean {
const isCurrentUserStaff = useIsCurrentUserStaff();
return __DEV__ || isStaffRelease || isCurrentUserStaff;
}
-export { isStaffRelease, useIsCurrentUserStaff, useStaffCanSee };
+export { isStaffRelease, useStaffCanSee };

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 8, 9:54 AM (1 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2816137
Default Alt Text
D9193.diff (3 KB)

Event Timeline