Page MenuHomePhabricator

D7420.id25109.diff
No OneTemporary

D7420.id25109.diff

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

Mime Type
text/plain
Expires
Sun, Dec 22, 7:29 AM (6 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690562
Default Alt Text
D7420.id25109.diff (1 KB)

Event Timeline