( threadInfo: ?(ThreadInfo | LegacyRawThreadInfo | RawThreadInfo), permission: ThreadPermissionNotAffectedByBlock, )
| 125 | } from '../utils/validation-utils.js'; |
| 126 | |
| 127 | function threadHasPermission( |
| 128 | threadInfo: ?(ThreadInfo | LegacyRawThreadInfo | RawThreadInfo), |
| 129 | permission: ThreadPermissionNotAffectedByBlock, |
| 130 | ): boolean { |
| 131 | if (!threadInfo) { |
| 132 | return false; |
| 133 | } |
| 134 | invariant( |
| 135 | !permissionsDisabledByBlock.has(permission) || threadInfo?.uiName, |
| 136 | `${permission} can be disabled by a block, but threadHasPermission can't ` + |
| 137 | 'check for a block on RawThreadInfo. Please pass in ThreadInfo instead!', |
| 138 | ); |
| 139 | if (threadInfo.minimallyEncoded) { |
| 140 | return hasPermission(threadInfo.currentUser.permissions, permission); |
| 141 | } |
| 142 | return permissionLookup(threadInfo.currentUser.permissions, permission); |
| 143 | } |
| 144 | |
| 145 | type CommunityRootMembersToRoleType = { |
| 146 | +[threadID: ?string]: { |
no test coverage detected