Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3157226
D10285.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10285.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
@@ -6,6 +6,7 @@
import _omitBy from 'lodash/fp/omitBy.js';
import * as React from 'react';
+import { getUserAvatarForThread } from './avatar-utils.js';
import { generatePendingThreadColor } from './color-utils.js';
import { type ParserRules } from './markdown.js';
import { extractUserMentionsFromText } from './mention-utils.js';
@@ -50,7 +51,6 @@
getRelativeMemberInfos,
usersWithPersonalThreadSelector,
} from '../selectors/user-selectors.js';
-import { getUserAvatarForThread } from '../shared/avatar-utils.js';
import type { CalendarQuery } from '../types/entry-types.js';
import { messageTypes } from '../types/message-types-enum.js';
import {
@@ -890,26 +890,53 @@
}
function threadInfoFromRawThreadInfo(
- rawThreadInfo: LegacyRawThreadInfo,
+ rawThreadInfo: RawThreadInfo,
viewerID: ?string,
userInfos: UserInfos,
): MinimallyEncodedThreadInfo {
- let threadInfo: LegacyThreadInfo = {
- id: rawThreadInfo.id,
- type: rawThreadInfo.type,
- name: rawThreadInfo.name,
- uiName: '',
- description: rawThreadInfo.description,
- color: rawThreadInfo.color,
- creationTime: rawThreadInfo.creationTime,
- parentThreadID: rawThreadInfo.parentThreadID,
- containingThreadID: rawThreadInfo.containingThreadID,
- community: rawThreadInfo.community,
- members: getRelativeMemberInfos(rawThreadInfo, viewerID, userInfos),
- roles: rawThreadInfo.roles,
- currentUser: getCurrentUser(rawThreadInfo, viewerID, userInfos),
- repliesCount: rawThreadInfo.repliesCount,
- };
+ let threadInfo: ThreadInfo;
+ if (rawThreadInfo.minimallyEncoded) {
+ threadInfo = {
+ minimallyEncoded: true,
+ id: rawThreadInfo.id,
+ type: rawThreadInfo.type,
+ name: rawThreadInfo.name,
+ uiName: '',
+ description: rawThreadInfo.description,
+ color: rawThreadInfo.color,
+ creationTime: rawThreadInfo.creationTime,
+ parentThreadID: rawThreadInfo.parentThreadID,
+ containingThreadID: rawThreadInfo.containingThreadID,
+ community: rawThreadInfo.community,
+ members: getRelativeMemberInfos(rawThreadInfo, viewerID, userInfos),
+ roles: rawThreadInfo.roles,
+ currentUser: getMinimallyEncodedCurrentUser(
+ rawThreadInfo,
+ viewerID,
+ userInfos,
+ ),
+ repliesCount: rawThreadInfo.repliesCount,
+ };
+ } else {
+ threadInfo = {
+ id: rawThreadInfo.id,
+ type: rawThreadInfo.type,
+ name: rawThreadInfo.name,
+ uiName: '',
+ description: rawThreadInfo.description,
+ color: rawThreadInfo.color,
+ creationTime: rawThreadInfo.creationTime,
+ parentThreadID: rawThreadInfo.parentThreadID,
+ containingThreadID: rawThreadInfo.containingThreadID,
+ community: rawThreadInfo.community,
+ members: getRelativeMemberInfos(rawThreadInfo, viewerID, userInfos),
+ roles: rawThreadInfo.roles,
+ currentUser: getCurrentUser(rawThreadInfo, viewerID, userInfos),
+ repliesCount: rawThreadInfo.repliesCount,
+ };
+ threadInfo = minimallyEncodeThreadInfo(threadInfo);
+ }
+
threadInfo = {
...threadInfo,
uiName: threadUIName(threadInfo),
@@ -934,7 +961,7 @@
if (pinnedCount) {
threadInfo = { ...threadInfo, pinnedCount };
}
- return minimallyEncodeThreadInfo(threadInfo);
+ return threadInfo;
}
function getCurrentUser(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 7:44 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2431874
Default Alt Text
D10285.diff (3 KB)
Attached To
Mode
D10285: [lib] Naively update `threadInfoFromRawThreadInfo` to support `RawThreadInfo` argument
Attached
Detach File
Event Timeline
Log In to Comment