Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3323328
D9514.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D9514.diff
View Options
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
@@ -10,44 +10,16 @@
MinimallyEncodedThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
import {
- type UserSurfacedPermissionOption,
- userSurfacedPermissions,
- userSurfacedPermissionOptions,
configurableCommunityPermissions,
type ThreadRolePermissionsBlob,
type UserSurfacedPermission,
} from '../types/thread-permission-types.js';
-import { type ThreadType, threadTypes } from '../types/thread-types-enum.js';
import type {
ThreadInfo,
RelativeMemberInfo,
RoleInfo,
-} from '../types/thread-types.js';
-
-function useFilterPermissionOptionsByThreadType(
- threadType: ThreadType,
-): $ReadOnlySet<UserSurfacedPermissionOption> {
- // 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]);
-}
+} from '../types/thread-types';
+import { threadTypes } from '../types/thread-types-enum.js';
function constructRoleDeletionMessagePrompt(
defaultRoleName: string,
@@ -155,7 +127,6 @@
}
export {
- useFilterPermissionOptionsByThreadType,
constructRoleDeletionMessagePrompt,
useRoleDeletableAndEditableStatus,
useRolesFromCommunityThreadInfo,
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
@@ -11,9 +11,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';
@@ -140,12 +140,9 @@
],
);
- const filteredUserSurfacedPermissionOptions =
- useFilterPermissionOptionsByThreadType(threadInfo.type);
-
const permissionsList = React.useMemo(
() =>
- [...filteredUserSurfacedPermissionOptions].map(permission => (
+ [...userSurfacedPermissionOptions].map(permission => (
<EnumSettingsOption
key={permission.title}
name={permission.title}
@@ -154,11 +151,7 @@
onEnumValuePress={() => 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,
@@ -21,7 +22,6 @@
} from 'lib/types/thread-types.js';
import { 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';
@@ -141,12 +141,9 @@
[],
);
- const filteredUserSurfacedPermissionOptions =
- useFilterPermissionOptionsByThreadType(threadInfo.type);
-
const permissionsList = React.useMemo(
() =>
- [...filteredUserSurfacedPermissionOptions].map(permission => (
+ [...userSurfacedPermissionOptions].map(permission => (
<EnumSettingsOption
key={permission.userSurfacedPermission}
selected={isUserSurfacedPermissionSelected(permission)}
@@ -157,11 +154,7 @@
statements={[{ statement: permission.description }]}
/>
)),
- [
- filteredUserSurfacedPermissionOptions,
- isUserSurfacedPermissionSelected,
- onEnumValuePress,
- ],
+ [isUserSurfacedPermissionSelected, onEnumValuePress],
);
const errorMessageClassNames = classNames({
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 3:34 AM (21 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2552468
Default Alt Text
D9514.diff (5 KB)
Attached To
Mode
D9514: [lib/web/native] Show voiced_in_announcement_channels user-surfaced permission for all community types
Attached
Detach File
Event Timeline
Log In to Comment