Page MenuHomePhabricator

D13910.diff
No OneTemporary

D13910.diff

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

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)

Event Timeline