Page MenuHomePhabricator

D12245.id40782.diff
No OneTemporary

D12245.id40782.diff

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
@@ -64,6 +64,7 @@
type ThreadRolePermissionsBlob,
type UserSurfacedPermission,
threadPermissionFilterPrefixes,
+ threadPermissionsDisabledByBlock,
} from '../types/thread-permission-types.js';
import {
type ThreadType,
@@ -1009,19 +1010,9 @@
return invalidated;
}
-const permissionsDisabledByBlockArray = [
- threadPermissions.VOICED,
- threadPermissions.EDIT_ENTRIES,
- threadPermissions.EDIT_THREAD_NAME,
- threadPermissions.EDIT_THREAD_COLOR,
- threadPermissions.EDIT_THREAD_DESCRIPTION,
- threadPermissions.CREATE_SUBCHANNELS,
- threadPermissions.CREATE_SIDEBARS,
- threadPermissions.JOIN_THREAD,
- threadPermissions.EDIT_PERMISSIONS,
- threadPermissions.ADD_MEMBERS,
- threadPermissions.REMOVE_MEMBERS,
-];
+const permissionsDisabledByBlockArray = values(
+ threadPermissionsDisabledByBlock,
+);
const permissionsDisabledByBlock: Set<ThreadPermission> = new Set(
permissionsDisabledByBlockArray,
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
@@ -6,25 +6,29 @@
import { values } from '../utils/objects.js';
import { tBool, tShape, tID } from '../utils/validation-utils.js';
-// 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({
- KNOW_OF: 'know_of',
- VISIBLE: 'visible',
+export const threadPermissionsDisabledByBlock = Object.freeze({
VOICED: 'voiced',
EDIT_ENTRIES: 'edit_entries',
EDIT_THREAD_NAME: 'edit_thread',
EDIT_THREAD_DESCRIPTION: 'edit_thread_description',
EDIT_THREAD_COLOR: 'edit_thread_color',
- DELETE_THREAD: 'delete_thread',
CREATE_SUBCHANNELS: 'create_subthreads',
CREATE_SIDEBARS: 'create_sidebars',
JOIN_THREAD: 'join_thread',
EDIT_PERMISSIONS: 'edit_permissions',
ADD_MEMBERS: 'add_members',
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,
+ KNOW_OF: 'know_of',
+ VISIBLE: 'visible',
+ DELETE_THREAD: 'delete_thread',
CHANGE_ROLE: 'change_role',
LEAVE_THREAD: 'leave_thread',
REACT_TO_MESSAGE: 'react_to_message',

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 8:37 AM (19 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2429787
Default Alt Text
D12245.id40782.diff (2 KB)

Event Timeline