diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -65,6 +65,7 @@ type UserSurfacedPermission, threadPermissionFilterPrefixes, threadPermissionsDisabledByBlock, + type ThreadPermissionNotAffectedByBlock, } from '../types/thread-permission-types.js'; import { type ThreadType, @@ -102,7 +103,7 @@ function threadHasPermission( threadInfo: ?(ThreadInfo | LegacyRawThreadInfo | RawThreadInfo), - permission: ThreadPermission, + permission: ThreadPermissionNotAffectedByBlock, ): boolean { if (!threadInfo) { return false; diff --git a/lib/types/thread-permission-types.js b/lib/types/thread-permission-types.js --- a/lib/types/thread-permission-types.js +++ b/lib/types/thread-permission-types.js @@ -20,12 +20,7 @@ REMOVE_MEMBERS: 'remove_members', }); -// When a new permission is added, if it should be configurable for a role, it -// should be either added to an existing set or a new set alongside a -// new user-facing permission. If it is a permission that should be ensured -// across all roles, it should be added to `universalCommunityPermissions`. -export const threadPermissions = Object.freeze({ - ...threadPermissionsDisabledByBlock, +export const threadPermissionsNotAffectedByBlock = Object.freeze({ KNOW_OF: 'know_of', VISIBLE: 'visible', DELETE_THREAD: 'delete_thread', @@ -38,6 +33,19 @@ MANAGE_INVITE_LINKS: 'manage_invite_links', VOICED_IN_ANNOUNCEMENT_CHANNELS: 'voiced_in_announcement_channels', }); + +export type ThreadPermissionNotAffectedByBlock = $Values< + typeof threadPermissionsNotAffectedByBlock, +>; + +// When a new permission is added, if it should be configurable for a role, it +// should be either added to an existing set or a new set alongside a +// new user-facing permission. If it is a permission that should be ensured +// across all roles, it should be added to `universalCommunityPermissions`. +export const threadPermissions = Object.freeze({ + ...threadPermissionsDisabledByBlock, + ...threadPermissionsNotAffectedByBlock, +}); export type ThreadPermission = $Values; export function assertThreadPermissions(