diff --git a/lib/utils/role-utils.js b/lib/utils/role-utils.js --- a/lib/utils/role-utils.js +++ b/lib/utils/role-utils.js @@ -2,39 +2,6 @@ import * as React from 'react'; -import { - type UserSurfacedPermissionOption, - userSurfacedPermissions, - userSurfacedPermissionOptions, -} from '../types/thread-permission-types.js'; -import type { ThreadType } from '../types/thread-types-enum.js'; -import { threadTypes } from '../types/thread-types-enum.js'; - -function useFilterPermissionOptionsByThreadType( - threadType: ThreadType, -): $ReadOnlySet { - // If the thread is a community announcement root, we want to allow - // the option to be voiced in the announcement channels. Otherwise, - // we want to remove that option from being configured since this will - // be guaranteed on the keyserver. - const shouldFilterVoicedInAnnouncementChannel = - threadType === threadTypes.COMMUNITY_ROOT; - - return React.useMemo(() => { - if (!shouldFilterVoicedInAnnouncementChannel) { - return userSurfacedPermissionOptions; - } - - return new Set( - [...userSurfacedPermissionOptions].filter( - option => - option.userSurfacedPermission !== - userSurfacedPermissions.VOICED_IN_ANNOUNCEMENT_CHANNELS, - ), - ); - }, [shouldFilterVoicedInAnnouncementChannel]); -} - function constructRoleDeletionMessagePrompt( defaultRoleName: string, memberCount: number, @@ -75,7 +42,6 @@ } export { - useFilterPermissionOptionsByThreadType, constructRoleDeletionMessagePrompt, useRoleDeletableAndEditableStatus, }; diff --git a/native/roles/create-roles-screen.react.js b/native/roles/create-roles-screen.react.js --- a/native/roles/create-roles-screen.react.js +++ b/native/roles/create-roles-screen.react.js @@ -10,9 +10,9 @@ import { type UserSurfacedPermissionOption, type UserSurfacedPermission, + userSurfacedPermissionOptions, } from 'lib/types/thread-permission-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; -import { useFilterPermissionOptionsByThreadType } from 'lib/utils/role-utils.js'; import CreateRolesHeaderRightButton from './create-roles-header-right-button.react.js'; import type { RolesNavigationProp } from './roles-navigator.react.js'; @@ -139,12 +139,9 @@ ], ); - const filteredUserSurfacedPermissionOptions = - useFilterPermissionOptionsByThreadType(threadInfo.type); - const permissionsList = React.useMemo( () => - [...filteredUserSurfacedPermissionOptions].map(permission => ( + [...userSurfacedPermissionOptions].map(permission => ( onEnumValuePress(permission)} /> )), - [ - isUserSurfacedPermissionSelected, - filteredUserSurfacedPermissionOptions, - onEnumValuePress, - ], + [isUserSurfacedPermissionSelected, onEnumValuePress], ); const onChangeRoleNameInput = React.useCallback((roleName: string) => { diff --git a/web/roles/create-roles-modal.react.js b/web/roles/create-roles-modal.react.js --- a/web/roles/create-roles-modal.react.js +++ b/web/roles/create-roles-modal.react.js @@ -11,9 +11,10 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { - UserSurfacedPermission, - UserSurfacedPermissionOption, +import { + type UserSurfacedPermission, + type UserSurfacedPermissionOption, + userSurfacedPermissionOptions, } from 'lib/types/thread-permission-types.js'; import type { ThreadInfo, @@ -24,7 +25,6 @@ useDispatchActionPromise, } from 'lib/utils/action-utils.js'; import { values } from 'lib/utils/objects.js'; -import { useFilterPermissionOptionsByThreadType } from 'lib/utils/role-utils.js'; import css from './create-roles-modal.css'; import Button, { buttonThemes } from '../components/button.react.js'; @@ -144,12 +144,9 @@ [], ); - const filteredUserSurfacedPermissionOptions = - useFilterPermissionOptionsByThreadType(threadInfo.type); - const permissionsList = React.useMemo( () => - [...filteredUserSurfacedPermissionOptions].map(permission => ( + [...userSurfacedPermissionOptions].map(permission => ( )), - [ - filteredUserSurfacedPermissionOptions, - isUserSurfacedPermissionSelected, - onEnumValuePress, - ], + [isUserSurfacedPermissionSelected, onEnumValuePress], ); const errorMessageClassNames = classNames({