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 @@ MinimallyEncodedThreadCurrentUserInfo, MinimallyEncodedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; +import { decodeMinimallyEncodedRoleInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; import { threadPermissionPropagationPrefixes, @@ -1480,7 +1481,9 @@ return !!messageItem.threadCreatedFromMessage || canCreateSidebarFromMessage; } -function checkIfDefaultMembersAreVoiced(threadInfo: ThreadInfo): boolean { +function checkIfDefaultMembersAreVoiced( + threadInfo: ThreadInfo | MinimallyEncodedThreadInfo, +): boolean { const defaultRoleID = Object.keys(threadInfo.roles).find( roleID => threadInfo.roles[roleID].isDefault, ); @@ -1489,7 +1492,11 @@ 'all threads should have a default role', ); const defaultRole = threadInfo.roles[defaultRoleID]; - return !!defaultRole.permissions[threadPermissions.VOICED]; + const defaultRolePermissions = defaultRole.minimallyEncoded + ? decodeMinimallyEncodedRoleInfo(defaultRole).permissions + : defaultRole.permissions; + + return !!defaultRolePermissions[threadPermissions.VOICED]; } const draftKeySuffix = '/message_composer';