Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3532972
D12246.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12246.diff
View Options
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<typeof threadPermissions>;
export function assertThreadPermissions(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 10:40 AM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2705372
Default Alt Text
D12246.diff (2 KB)
Attached To
Mode
D12246: [lib] Narrow `threadHasPermission` so it only accepts `ThreadPermissionNotAffectedByBlock`
Attached
Detach File
Event Timeline
Log In to Comment