Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3497621
D7420.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
D7420.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
@@ -1301,9 +1301,9 @@
const now = Date.now();
const messageIDsToPrune = [];
- const newThreads = { ...messageStore.threads };
+ const updatedThreads = {};
for (const threadID of action.payload.threadIDs) {
- let thread = newThreads[threadID];
+ let thread = messageStore.threads[threadID];
if (!thread) {
continue;
}
@@ -1322,7 +1322,7 @@
messageIDsToPrune.push(id);
}
- newThreads[threadID] = thread;
+ updatedThreads[threadID] = thread;
}
const messageStoreOperations = [
@@ -1330,20 +1330,38 @@
type: 'remove',
payload: { ids: messageIDsToPrune },
},
+ {
+ type: 'replace_threads',
+ payload: {
+ threads: updatedThreads,
+ },
+ },
];
+
const processedMessageStore = processMessageStoreOperations(
messageStore,
messageStoreOperations,
);
+ const newMessageStore = {
+ messages: processedMessageStore.messages,
+ threads: {
+ ...messageStore.threads,
+ ...updatedThreads,
+ },
+ local: _omit(messageIDsToPrune)(messageStore.local),
+ currentAsOf: messageStore.currentAsOf,
+ };
+
+ assertMessageStoreThreadsAreEqual(
+ processedMessageStore,
+ newMessageStore,
+ action.type,
+ );
+
return {
messageStoreOperations,
- messageStore: {
- messages: processedMessageStore.messages,
- threads: newThreads,
- local: _omit(messageIDsToPrune)(messageStore.local),
- currentAsOf: messageStore.currentAsOf,
- },
+ messageStore: newMessageStore,
};
} else if (action.type === updateMultimediaMessageMediaActionType) {
const { messageID: id, currentMediaID, mediaUpdate } = action.payload;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 7:30 PM (18 h, 24 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2682584
Default Alt Text
D7420.diff (1 KB)
Attached To
Mode
D7420: [lib] generate message store ops for threads after pruning messages
Attached
Detach File
Event Timeline
Log In to Comment