Page MenuHomePhabricator

D12370.id41246.diff
No OneTemporary

D12370.id41246.diff

diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -33,6 +33,8 @@
} from 'lib/ops/keyserver-store-ops.js';
import {
type ClientDBMessageStoreOperation,
+ type ReplaceMessageStoreLocalMessageInfoOperation,
+ type MessageStoreOperation,
messageStoreOpsHandlers,
} from 'lib/ops/message-store-ops.js';
import {
@@ -1346,6 +1348,41 @@
state,
ops: [],
}),
+ [76]: (state: AppState) => {
+ const localMessageInfos = state.messageStore.local;
+
+ const replaceOps: $ReadOnlyArray<ReplaceMessageStoreLocalMessageInfoOperation> =
+ entries(localMessageInfos).map(([id, message]) => ({
+ type: 'replace_local_message_info',
+ payload: {
+ id,
+ localMessageInfo: message,
+ },
+ }));
+
+ const operations: $ReadOnlyArray<MessageStoreOperation> = [
+ {
+ type: 'remove_all_local_message_infos',
+ },
+ ...replaceOps,
+ ];
+
+ const newMessageStore = messageStoreOpsHandlers.processStoreOperations(
+ state.messageStore,
+ operations,
+ );
+
+ const dbOperations: $ReadOnlyArray<ClientDBMessageStoreOperation> =
+ messageStoreOpsHandlers.convertOpsToClientDBOps(operations);
+
+ return {
+ state: {
+ ...state,
+ messageStore: newMessageStore,
+ },
+ ops: dbOperations,
+ };
+ },
};
// NOTE: renaming this object, and especially the `version` property
@@ -1356,7 +1393,7 @@
storage: AsyncStorage,
blacklist: persistBlacklist,
debug: __DEV__,
- version: 75,
+ version: 76,
transforms: [
messageStoreMessagesBlocklistTransform,
reportStoreTransform,
diff --git a/web/redux/persist-constants.js b/web/redux/persist-constants.js
--- a/web/redux/persist-constants.js
+++ b/web/redux/persist-constants.js
@@ -3,6 +3,6 @@
const rootKey = 'root';
const rootKeyPrefix = 'persist:';
const completeRootKey = `${rootKeyPrefix}${rootKey}`;
-const storeVersion = 75;
+const storeVersion = 76;
export { rootKey, rootKeyPrefix, completeRootKey, storeVersion };
diff --git a/web/redux/persist.js b/web/redux/persist.js
--- a/web/redux/persist.js
+++ b/web/redux/persist.js
@@ -10,7 +10,12 @@
keyserverStoreOpsHandlers,
type ReplaceKeyserverOperation,
} from 'lib/ops/keyserver-store-ops.js';
-import type { ClientDBMessageStoreOperation } from 'lib/ops/message-store-ops.js';
+import {
+ messageStoreOpsHandlers,
+ type ReplaceMessageStoreLocalMessageInfoOperation,
+ type ClientDBMessageStoreOperation,
+ type MessageStoreOperation,
+} from 'lib/ops/message-store-ops.js';
import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import { patchRawThreadInfoWithSpecialRole } from 'lib/permissions/special-roles.js';
import { keyserverStoreTransform } from 'lib/shared/transforms/keyserver-store-transform.js';
@@ -512,6 +517,41 @@
state,
ops: [],
}),
+ [76]: async (state: AppState) => {
+ const localMessageInfos = state.messageStore.local;
+
+ const replaceOps: $ReadOnlyArray<ReplaceMessageStoreLocalMessageInfoOperation> =
+ entries(localMessageInfos).map(([id, localMessageInfo]) => ({
+ type: 'replace_local_message_info',
+ payload: {
+ id,
+ localMessageInfo,
+ },
+ }));
+
+ const operations: $ReadOnlyArray<MessageStoreOperation> = [
+ {
+ type: 'remove_all_local_message_infos',
+ },
+ ...replaceOps,
+ ];
+
+ const newMessageStore = messageStoreOpsHandlers.processStoreOperations(
+ state.messageStore,
+ operations,
+ );
+
+ const dbOperations: $ReadOnlyArray<ClientDBMessageStoreOperation> =
+ messageStoreOpsHandlers.convertOpsToClientDBOps(operations);
+
+ return {
+ state: {
+ ...state,
+ messageStore: newMessageStore,
+ },
+ ops: dbOperations,
+ };
+ },
};
const persistConfig: PersistConfig = {

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 1:08 AM (11 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2702652
Default Alt Text
D12370.id41246.diff (3 KB)

Event Timeline