MCPcopy Create free account
hub / github.com/CommE2E/comm / includeThreadPermissionForThreadType

Function includeThreadPermissionForThreadType

lib/permissions/prefixes.js:76–102  ·  view source on GitHub ↗
(
  parsed: ParsedThreadPermissionString,
  threadType: ThreadType,
  isMember: boolean,
)

Source from the content-addressed store, hash-verified

74}
75
76function includeThreadPermissionForThreadType(
77 parsed: ParsedThreadPermissionString,
78 threadType: ThreadType,
79 isMember: boolean,
80): boolean {
81 if (
82 threadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD &&
83 threadType !== threadTypes.COMMUNITY_OPEN_ANNOUNCEMENT_SUBTHREAD &&
84 !threadTypeIsSidebar(threadType) &&
85 (parsed.filterPrefix === threadPermissionFilterPrefixes.OPEN ||
86 parsed.filterPrefix === threadPermissionFilterPrefixes.OPEN_TOP_LEVEL)
87 ) {
88 return false;
89 } else if (
90 threadTypeIsSidebar(threadType) &&
91 (parsed.filterPrefix === threadPermissionFilterPrefixes.TOP_LEVEL ||
92 parsed.filterPrefix === threadPermissionFilterPrefixes.OPEN_TOP_LEVEL)
93 ) {
94 return false;
95 } else if (
96 !isMember &&
97 parsed.membershipPrefix === threadPermissionMembershipPrefixes.MEMBER
98 ) {
99 return false;
100 }
101 return true;
102}
103
104const { CHILD, DESCENDANT } = threadPermissionPropagationPrefixes;
105const { OPEN, TOP_LEVEL, OPEN_TOP_LEVEL } = threadPermissionFilterPrefixes;

Callers 1

makePermissionsBlobFunction · 0.90

Calls 1

threadTypeIsSidebarFunction · 0.90

Tested by

no test coverage detected