Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32936814
D3145.1768246915.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D3145.1768246915.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
@@ -1190,39 +1190,37 @@
usersSearchResults: $ReadOnlyArray<GlobalAccountUserInfo>,
viewerID: ?string,
): $ReadOnlyArray<ChatThreadItem> {
- const chatItems = [];
if (!searchText) {
- chatItems.push(
- ...chatListData.filter(
- item =>
- threadIsTopLevel(item.threadInfo) && threadFilter(item.threadInfo),
- ),
+ return chatListData.filter(
+ item =>
+ threadIsTopLevel(item.threadInfo) && threadFilter(item.threadInfo),
);
- } else {
- const privateThreads = [];
- const personalThreads = [];
- const otherThreads = [];
- for (const item of chatListData) {
- if (!threadSearchResults.has(item.threadInfo.id)) {
- continue;
- }
- if (item.threadInfo.type === threadTypes.PRIVATE) {
- privateThreads.push({ ...item, sidebars: [] });
- } else if (item.threadInfo.type === threadTypes.PERSONAL) {
- personalThreads.push({ ...item, sidebars: [] });
- } else {
- otherThreads.push({ ...item, sidebars: [] });
- }
+ }
+
+ const privateThreads = [];
+ const personalThreads = [];
+ const otherThreads = [];
+ for (const item of chatListData) {
+ if (!threadSearchResults.has(item.threadInfo.id)) {
+ continue;
}
- chatItems.push(...privateThreads, ...personalThreads, ...otherThreads);
- if (viewerID) {
- chatItems.push(
- ...usersSearchResults.map(user =>
- createPendingThreadItem(viewerID, user),
- ),
- );
+ if (item.threadInfo.type === threadTypes.PRIVATE) {
+ privateThreads.push({ ...item, sidebars: [] });
+ } else if (item.threadInfo.type === threadTypes.PERSONAL) {
+ personalThreads.push({ ...item, sidebars: [] });
+ } else {
+ otherThreads.push({ ...item, sidebars: [] });
}
}
+
+ const chatItems = [...privateThreads, ...personalThreads, ...otherThreads];
+ if (viewerID) {
+ chatItems.push(
+ ...usersSearchResults.map(user =>
+ createPendingThreadItem(viewerID, user),
+ ),
+ );
+ }
return chatItems;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 12, 7:41 PM (14 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5924596
Default Alt Text
D3145.1768246915.diff (2 KB)
Attached To
Mode
D3145: [lib] Simplify filterChatThreadList
Attached
Detach File
Event Timeline
Log In to Comment