Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3245662
D9848.id33222.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
D9848.id33222.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
@@ -114,6 +114,7 @@
entityTextToRawString,
getEntityTextAsString,
type ThreadEntity,
+ type UserEntity,
} from '../utils/entity-text.js';
import { useSelector } from '../utils/redux-utils.js';
import { firstLine } from '../utils/string-utils.js';
@@ -935,16 +936,26 @@
return rawThreadInfo;
}
-function threadUIName(threadInfo: ThreadInfo): string | ThreadEntity {
+function threadUIName(
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+): string | ThreadEntity {
if (threadInfo.name) {
return firstLine(threadInfo.name);
}
- const threadMembers = threadInfo.members.filter(
- memberInfo => memberInfo.role,
- );
- const memberEntities = threadMembers.map(member =>
- ET.user({ userInfo: member }),
- );
+
+ let threadMembers:
+ | $ReadOnlyArray<MinimallyEncodedRelativeMemberInfo>
+ | $ReadOnlyArray<RelativeMemberInfo>;
+ let memberEntities: $ReadOnlyArray<UserEntity>;
+ // Branching below is to appease flow
+ if (threadInfo.minimallyEncoded) {
+ threadMembers = threadInfo.members.filter(memberInfo => memberInfo.role);
+ memberEntities = threadMembers.map(member => ET.user({ userInfo: member }));
+ } else {
+ threadMembers = threadInfo.members.filter(memberInfo => memberInfo.role);
+ memberEntities = threadMembers.map(member => ET.user({ userInfo: member }));
+ }
+
return {
type: 'thread',
id: threadInfo.id,
diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js
--- a/lib/utils/entity-text.js
+++ b/lib/utils/entity-text.js
@@ -17,7 +17,7 @@
import { type RawThreadInfo, type ThreadInfo } from '../types/thread-types.js';
import { basePluralize } from '../utils/text-utils.js';
-type UserEntity = {
+export type UserEntity = {
+type: 'user',
+id: string,
+username?: ?string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 7:54 PM (17 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2494979
Default Alt Text
D9848.id33222.diff (1 KB)
Attached To
Mode
D9848: [lib] Update `threadUIName` to handle `MinimallyEncodedThreadInfo`
Attached
Detach File
Event Timeline
Log In to Comment