Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509701
D7420.id25109.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.id25109.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
@@ -1309,9 +1309,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;
}
@@ -1330,7 +1330,7 @@
messageIDsToPrune.push(id);
}
- newThreads[threadID] = thread;
+ updatedThreads[threadID] = thread;
}
const messageStoreOperations = [
@@ -1338,20 +1338,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
Sun, Dec 22, 7:29 AM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690562
Default Alt Text
D7420.id25109.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