Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3300006
D9889.id33233.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9889.id33233.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9889: [lib] Update `checkIfDefaultMembersAreVoiced` to handle `MinimallyEncodedThreadInfo`
Attached
Detach File
Event Timeline
Log In to Comment