diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js --- a/lib/reducers/master-reducer.js +++ b/lib/reducers/master-reducer.js @@ -161,7 +161,7 @@ action, ); - const { integrityStore } = reduceIntegrityStore( + const { integrityStore, integrityStoreOperations } = reduceIntegrityStore( state.integrityStore, action, threadInfos, @@ -217,6 +217,7 @@ userStoreOperations, keyserverStoreOperations, communityStoreOperations, + integrityStoreOperations, }, }; } diff --git a/lib/types/store-ops-types.js b/lib/types/store-ops-types.js --- a/lib/types/store-ops-types.js +++ b/lib/types/store-ops-types.js @@ -22,6 +22,7 @@ import type { ClientDBIntegrityThreadHash, ClientDBIntegrityStoreOperation, + IntegrityStoreOperation, } from '../ops/integrity-store-ops.js'; import type { ClientDBKeyserverInfo, @@ -54,6 +55,7 @@ +userStoreOperations: $ReadOnlyArray, +keyserverStoreOperations: $ReadOnlyArray, +communityStoreOperations: $ReadOnlyArray, + +integrityStoreOperations: $ReadOnlyArray, }; export type ClientDBStoreOperations = { diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js --- a/native/redux/redux-setup.js +++ b/native/redux/redux-setup.js @@ -289,6 +289,7 @@ userStoreOperations, keyserverStoreOperations, communityStoreOperations, + integrityStoreOperations, } = storeOperations; const fixUnreadActiveThreadResult = fixUnreadActiveThread(state, action); @@ -307,6 +308,7 @@ userStoreOperations, keyserverStoreOperations, communityStoreOperations, + integrityStoreOperations, }); return state; diff --git a/native/redux/redux-utils.js b/native/redux/redux-utils.js --- a/native/redux/redux-utils.js +++ b/native/redux/redux-utils.js @@ -3,6 +3,7 @@ import { useSelector as reactReduxUseSelector } from 'react-redux'; import { communityStoreOpsHandlers } from 'lib/ops/community-store-ops.js'; +import { integrityStoreOpsHandlers } from 'lib/ops/integrity-store-ops.js'; import { keyserverStoreOpsHandlers, getKeyserversToRemoveFromNotifsStore, @@ -34,6 +35,7 @@ reportStoreOperations, userStoreOperations, keyserverStoreOperations, + integrityStoreOperations, communityStoreOperations, } = storeOperations; @@ -51,6 +53,8 @@ communityStoreOpsHandlers.convertOpsToClientDBOps(communityStoreOperations); const keyserversToRemoveFromNotifsStore = getKeyserversToRemoveFromNotifsStore(keyserverStoreOperations); + const convertedIntegrityStoreOperations = + integrityStoreOpsHandlers.convertOpsToClientDBOps(integrityStoreOperations); try { const promises = []; @@ -106,6 +110,13 @@ ), ); } + if (convertedIntegrityStoreOperations.length > 0) { + promises.push( + commCoreModule.processIntegrityStoreOperations( + convertedIntegrityStoreOperations, + ), + ); + } await Promise.all(promises); } catch (e) { if (isTaskCancelledError(e)) { diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -125,6 +125,7 @@ userStoreOperations: [], keyserverStoreOperations: [], communityStoreOperations: [], + integrityStoreOperations: [], }, currentLoggedInUserID, ); diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -147,6 +147,7 @@ userStoreOperations: [], keyserverStoreOperations: [], communityStoreOperations: [], + integrityStoreOperations: [], }; if (action.type === setInitialReduxState) { diff --git a/web/shared-worker/utils/store.js b/web/shared-worker/utils/store.js --- a/web/shared-worker/utils/store.js +++ b/web/shared-worker/utils/store.js @@ -1,6 +1,7 @@ // @flow import { communityStoreOpsHandlers } from 'lib/ops/community-store-ops.js'; +import { integrityStoreOpsHandlers } from 'lib/ops/integrity-store-ops.js'; import { keyserverStoreOpsHandlers } from 'lib/ops/keyserver-store-ops.js'; import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js'; import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js'; @@ -81,6 +82,7 @@ reportStoreOperations, keyserverStoreOperations, communityStoreOperations, + integrityStoreOperations, } = storeOperations; const canUseDatabase = canUseDatabaseOnWeb(userID); @@ -94,13 +96,16 @@ keyserverStoreOpsHandlers.convertOpsToClientDBOps(keyserverStoreOperations); const convertedCommunityStoreOperations = communityStoreOpsHandlers.convertOpsToClientDBOps(communityStoreOperations); + const convertedIntegrityStoreOperations = + integrityStoreOpsHandlers.convertOpsToClientDBOps(integrityStoreOperations); if ( convertedThreadStoreOperations.length === 0 && convertedReportStoreOperations.length === 0 && draftStoreOperations.length === 0 && convertedKeyserverStoreOperations.length === 0 && - convertedCommunityStoreOperations.length === 0 + convertedCommunityStoreOperations.length === 0 && + convertedIntegrityStoreOperations.length === 0 ) { return; } @@ -119,6 +124,7 @@ threadStoreOperations: convertedThreadStoreOperations, keyserverStoreOperations: convertedKeyserverStoreOperations, communityStoreOperations: convertedCommunityStoreOperations, + integrityStoreOperations: convertedIntegrityStoreOperations, }, }); } catch (e) {