diff --git a/keyserver/src/fetchers/report-fetchers.js b/keyserver/src/fetchers/report-fetchers.js --- a/keyserver/src/fetchers/report-fetchers.js +++ b/keyserver/src/fetchers/report-fetchers.js @@ -1,6 +1,6 @@ // @flow -import { isStaff } from 'lib/shared/user-utils.js'; +import { isStaff } from 'lib/shared/staff-utils.js'; import { type FetchErrorReportInfosResponse, type FetchErrorReportInfosRequest, diff --git a/lib/reducers/report-store-reducer.js b/lib/reducers/report-store-reducer.js --- a/lib/reducers/report-store-reducer.js +++ b/lib/reducers/report-store-reducer.js @@ -11,7 +11,7 @@ deleteAccountActionTypes, logInActionTypes, } from '../actions/user-actions.js'; -import { isStaff } from '../shared/user-utils.js'; +import { isStaff } from '../shared/staff-utils.js'; import type { BaseAction } from '../types/redux-types.js'; import { type ReportStore, diff --git a/lib/shared/staff-utils.js b/lib/shared/staff-utils.js new file mode 100644 --- /dev/null +++ b/lib/shared/staff-utils.js @@ -0,0 +1,19 @@ +// @flow + +import bots from '../facts/bots.js'; +import staff from '../facts/staff.js'; + +function isStaff(userID: string): boolean { + if (staff.includes(userID)) { + return true; + } + for (const key in bots) { + const bot = bots[key]; + if (userID === bot.userID) { + return true; + } + } + return false; +} + +export { isStaff }; diff --git a/lib/shared/user-utils.js b/lib/shared/user-utils.js --- a/lib/shared/user-utils.js +++ b/lib/shared/user-utils.js @@ -1,12 +1,10 @@ // @flow import { memberHasAdminPowers } from './thread-utils.js'; -import bots from '../facts/bots.js'; -import staff from '../facts/staff.js'; import { useENSNames } from '../hooks/ens-cache.js'; import type { - ServerThreadInfo, RawThreadInfo, + ServerThreadInfo, ThreadInfo, } from '../types/thread-types.js'; import type { UserInfo } from '../types/user-types.js'; @@ -32,19 +30,6 @@ } } -function isStaff(userID: string): boolean { - if (staff.includes(userID)) { - return true; - } - for (const key in bots) { - const bot = bots[key]; - if (userID === bot.userID) { - return true; - } - } - return false; -} - function useKeyserverAdmin( community: ThreadInfo | RawThreadInfo | ServerThreadInfo, ): ?UserInfo { @@ -58,4 +43,4 @@ return adminUserInfoWithENSName; } -export { stringForUser, stringForUserExplicit, isStaff, useKeyserverAdmin }; +export { stringForUser, stringForUserExplicit, useKeyserverAdmin }; diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js --- a/native/redux/redux-setup.js +++ b/native/redux/redux-setup.js @@ -19,7 +19,7 @@ invalidSessionDowngrade, invalidSessionRecovery, } from 'lib/shared/account-utils.js'; -import { isStaff } from 'lib/shared/user-utils.js'; +import { isStaff } from 'lib/shared/staff-utils.js'; import { defaultEnabledApps } from 'lib/types/enabled-apps.js'; import { defaultCalendarFilters } from 'lib/types/filter-types.js'; import type { Dispatch, BaseAction } from 'lib/types/redux-types.js'; 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,6 +1,6 @@ // @flow -import { isStaff } from 'lib/shared/user-utils.js'; +import { isStaff } from 'lib/shared/staff-utils.js'; import { useSelector } from '../redux/redux-utils.js'; diff --git a/web/database/utils/db-utils.js b/web/database/utils/db-utils.js --- a/web/database/utils/db-utils.js +++ b/web/database/utils/db-utils.js @@ -3,7 +3,7 @@ import { detect as detectBrowser } from 'detect-browser'; import type { QueryExecResult } from 'sql.js'; -import { isStaff } from 'lib/shared/user-utils.js'; +import { isStaff } from 'lib/shared/staff-utils.js'; import { isDev } from 'lib/utils/dev-utils.js'; import { DB_SUPPORTED_BROWSERS, DB_SUPPORTED_OS } from './constants.js';