Page MenuHomePhabricator

D9889.id33233.diff
No OneTemporary

D9889.id33233.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
@@ -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';

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 4:44 PM (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535030
Default Alt Text
D9889.id33233.diff (1 KB)

Event Timeline