Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3243834
D13910.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
D13910.diff
View Options
diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js
--- a/lib/selectors/chat-selectors.js
+++ b/lib/selectors/chat-selectors.js
@@ -92,32 +92,23 @@
);
}
-function getMostRecentMessageInfo(
+function getLastUpdatedTime(
threadInfo: ThreadInfo,
messageStore: MessageStore,
messages: { +[id: string]: ?MessageInfo },
-): ?MessageInfo {
+): number {
const thread = messageStore.threads[threadInfo.id];
if (!thread) {
- return null;
+ return threadInfo.creationTime;
}
for (const messageID of thread.messageIDs) {
const messageInfo = messages[messageID];
if (!messageInfo || isEmptyMediaMessage(messageInfo)) {
continue;
}
- return messageInfo;
+ return messageInfo.time;
}
- return null;
-}
-
-function getLastUpdatedTime(
- threadInfo: ThreadInfo,
- mostRecentMessageInfo: ?MessageInfo,
-): number {
- return mostRecentMessageInfo
- ? mostRecentMessageInfo.time
- : threadInfo.creationTime;
+ return threadInfo.creationTime;
}
function useCreateChatThreadItem(): ThreadInfo => ChatThreadItem {
@@ -126,18 +117,14 @@
const messageStore = useSelector(state => state.messageStore);
return React.useCallback(
threadInfo => {
- const mostRecentMessageInfo = getMostRecentMessageInfo(
- threadInfo,
- messageStore,
- messageInfos,
- );
const mostRecentNonLocalMessage = getMostRecentNonLocalMessageID(
threadInfo.id,
messageStore,
);
const lastUpdatedTime = getLastUpdatedTime(
threadInfo,
- mostRecentMessageInfo,
+ messageStore,
+ messageInfos,
);
const sidebars = sidebarInfos[threadInfo.id] ?? [];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 9:27 AM (18 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2493986
Default Alt Text
D13910.diff (1 KB)
Attached To
Mode
D13910: [lib] Inline getMostRecentMessageInfo
Attached
Detach File
Event Timeline
Log In to Comment