Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32600320
D9897.1767431647.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9897.1767431647.diff
View Options
diff --git a/lib/permissions/thread-permissions.js b/lib/permissions/thread-permissions.js
--- a/lib/permissions/thread-permissions.js
+++ b/lib/permissions/thread-permissions.js
@@ -179,20 +179,12 @@
function getRolePermissionBlobsForCommunity(
threadType: ThreadType,
): RolePermissionBlobs {
- const openDescendantKnowOf = OPEN_DESCENDANT + threadPermissions.KNOW_OF;
- const openDescendantVisible = OPEN_DESCENDANT + threadPermissions.VISIBLE;
- const openTopLevelDescendantJoinThread =
- OPEN_TOP_LEVEL_DESCENDANT + threadPermissions.JOIN_THREAD;
const openChildJoinThread = OPEN_CHILD + threadPermissions.JOIN_THREAD;
const openChildAddMembers = OPEN_CHILD + threadPermissions.ADD_MEMBERS;
- const genesisMemberPermissions = {
- [threadPermissions.KNOW_OF]: true,
- [threadPermissions.VISIBLE]: true,
- [openDescendantKnowOf]: true,
- [openDescendantVisible]: true,
- [openTopLevelDescendantJoinThread]: true,
- };
+ const genesisMemberPermissions = getUniversalCommunityRootPermissionsBlob(
+ threadTypes.GENESIS,
+ );
const baseMemberPermissions = {
...genesisMemberPermissions,
[threadPermissions.REACT_TO_MESSAGE]: true,
@@ -405,6 +397,47 @@
return getRolePermissionBlobsForCommunity(threadType);
}
+function getUniversalCommunityRootPermissionsBlob(
+ threadType: ThreadType,
+): ThreadRolePermissionsBlob {
+ const openDescendantKnowOf = DESCENDANT + OPEN + threadPermissions.KNOW_OF;
+ const openDescendantVoiced = DESCENDANT + OPEN + threadPermissions.VOICED;
+ const openDescendantVisible = DESCENDANT + OPEN + threadPermissions.VISIBLE;
+ const openChildJoinThread = CHILD + OPEN + threadPermissions.JOIN_THREAD;
+ const openTopLevelDescendantJoinThread =
+ DESCENDANT + OPEN_TOP_LEVEL + threadPermissions.JOIN_THREAD;
+
+ const genesisUniversalCommunityPermissions = {
+ [threadPermissions.KNOW_OF]: true,
+ [threadPermissions.VISIBLE]: true,
+ [openDescendantKnowOf]: true,
+ [openDescendantVisible]: true,
+ [openTopLevelDescendantJoinThread]: true,
+ };
+
+ const baseUniversalCommunityPermissions = {
+ ...genesisUniversalCommunityPermissions,
+ [threadPermissions.JOIN_THREAD]: true,
+ [threadPermissions.CREATE_SIDEBARS]: true,
+ [threadPermissions.LEAVE_THREAD]: true,
+ [openDescendantVoiced]: true,
+ [openChildJoinThread]: true,
+ };
+
+ if (threadType === threadTypes.GENESIS) {
+ return genesisUniversalCommunityPermissions;
+ } else if (threadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT) {
+ return baseUniversalCommunityPermissions;
+ } else if (threadType === threadTypes.COMMUNITY_ROOT) {
+ return {
+ ...baseUniversalCommunityPermissions,
+ [threadPermissions.VOICED]: true,
+ };
+ } else {
+ return {};
+ }
+}
+
export {
permissionLookup,
getAllThreadPermissions,
@@ -412,4 +445,5 @@
makePermissionsForChildrenBlob,
getRoleForPermissions,
getRolePermissionBlobs,
+ getUniversalCommunityRootPermissionsBlob,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 3, 9:14 AM (8 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5887456
Default Alt Text
D9897.1767431647.diff (2 KB)
Attached To
Mode
D9897: [lib] Introduce getUniversalCommunityRootPermissionsBlob
Attached
Detach File
Event Timeline
Log In to Comment