Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3504948
D5670.id18568.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5670.id18568.diff
View Options
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -126,6 +126,13 @@
);
}
+const newThread = () => ({
+ messageIDs: [],
+ startReached: false,
+ lastNavigatedTo: 0,
+ lastPruned: Date.now(),
+});
+
type FreshMessageStoreResult = {
+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,
+messageStore: MessageStore,
@@ -154,14 +161,12 @@
const threadsToMessageIDs = mapThreadsToMessageIDsFromOrderedMessageInfos(
orderedMessageInfos,
);
- const lastPruned = Date.now();
const threads = _mapValuesWithKeys(
(messageIDs: string[], threadID: string) => ({
+ ...newThread(),
messageIDs,
startReached:
truncationStatus[threadID] === messageTruncationStatus.EXHAUSTIVE,
- lastNavigatedTo: 0,
- lastPruned,
}),
)(threadsToMessageIDs);
const watchedIDs = threadWatcher.getWatchedIDs();
@@ -173,12 +178,7 @@
) {
continue;
}
- threads[threadID] = {
- messageIDs: [],
- startReached: false,
- lastNavigatedTo: 0,
- lastPruned,
- };
+ threads[threadID] = newThread();
}
return {
messageStoreOperations,
@@ -418,7 +418,6 @@
);
const oldMessageInfosToCombine = [];
const threadsThatNeedMessageIDsResorted = [];
- const lastPruned = Date.now();
const local = {};
const threads = _flow(
_mapValuesWithKeys((messageIDs: string[], threadID: string) => {
@@ -426,10 +425,9 @@
const truncate = truncationStatus[threadID];
if (!oldThread) {
return {
+ ...newThread(),
messageIDs,
startReached: truncate === messageTruncationStatus.EXHAUSTIVE,
- lastNavigatedTo: 0,
- lastPruned,
};
}
let oldMessageIDsUnchanged = true;
@@ -611,12 +609,7 @@
isThreadWatched(threadID, threadInfo, watchedIDs) &&
!filteredThreads[threadID]
) {
- filteredThreads[threadID] = {
- messageIDs: [],
- startReached: false,
- lastNavigatedTo: 0,
- lastPruned: Date.now(),
- };
+ filteredThreads[threadID] = newThread();
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 11:27 AM (20 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686619
Default Alt Text
D5670.id18568.diff (2 KB)
Attached To
Mode
D5670: [lib] Introduce newThread helper to message-reducer.js
Attached
Detach File
Event Timeline
Log In to Comment