diff --git a/lib/reducers/db-ops-reducer.test.js b/lib/reducers/db-ops-reducer.test.js --- a/lib/reducers/db-ops-reducer.test.js +++ b/lib/reducers/db-ops-reducer.test.js @@ -15,6 +15,7 @@ integrityStoreOperations: [], syncedMetadataStoreOperations: [], auxUserStoreOperations: [], + threadActivityStoreOperations: [], }; describe('DB ops reducer', () => { 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 @@ -181,10 +181,8 @@ action, ); - const { threadActivityStore } = reduceThreadActivity( - state.threadActivityStore, - action, - ); + const { threadActivityStore, threadActivityStoreOperations } = + reduceThreadActivity(state.threadActivityStore, action); return { state: { @@ -237,6 +235,7 @@ integrityStoreOperations, syncedMetadataStoreOperations, auxUserStoreOperations, + threadActivityStoreOperations, }, }; } 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 @@ -51,6 +51,7 @@ ClientDBSyncedMetadataStoreOperation, } from '../ops/synced-metadata-store-ops.js'; import type { + ThreadActivityStoreOperation, ClientDBThreadActivityEntry, ClientDBThreadActivityStoreOperation, } from '../ops/thread-activity-store-ops.js'; @@ -75,6 +76,7 @@ +integrityStoreOperations: $ReadOnlyArray, +syncedMetadataStoreOperations: $ReadOnlyArray, +auxUserStoreOperations: $ReadOnlyArray, + +threadActivityStoreOperations: $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 @@ -302,6 +302,7 @@ integrityStoreOperations, syncedMetadataStoreOperations, auxUserStoreOperations, + threadActivityStoreOperations, } = storeOperations; const fixUnreadActiveThreadResult = fixUnreadActiveThread(state, action); @@ -323,6 +324,7 @@ integrityStoreOperations, syncedMetadataStoreOperations, auxUserStoreOperations, + threadActivityStoreOperations, }; state = { ...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 @@ -12,6 +12,7 @@ import { messageStoreOpsHandlers } from 'lib/ops/message-store-ops.js'; import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js'; import { syncedMetadataStoreOpsHandlers } from 'lib/ops/synced-metadata-store-ops.js'; +import { threadActivityStoreOpsHandlers } from 'lib/ops/thread-activity-store-ops.js'; import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js'; import { userStoreOpsHandlers } from 'lib/ops/user-store-ops.js'; import type { StoreOperations } from 'lib/types/store-ops-types.js'; @@ -41,6 +42,7 @@ communityStoreOperations, syncedMetadataStoreOperations, auxUserStoreOperations, + threadActivityStoreOperations, } = storeOperations; const convertedThreadStoreOperations = @@ -65,6 +67,10 @@ integrityStoreOpsHandlers.convertOpsToClientDBOps(integrityStoreOperations); const convertedAuxUserStoreOperations = auxUserStoreOpsHandlers.convertOpsToClientDBOps(auxUserStoreOperations); + const convertedThreadActivityStoreOperations = + threadActivityStoreOpsHandlers.convertOpsToClientDBOps( + threadActivityStoreOperations, + ); try { const promises = []; @@ -141,6 +147,13 @@ ), ); } + if (convertedThreadActivityStoreOperations.length > 0) { + promises.push( + commCoreModule.processThreadActivityStoreOperations( + convertedThreadActivityStoreOperations, + ), + ); + } 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 @@ -164,6 +164,7 @@ integrityStoreOperations: [], syncedMetadataStoreOperations: [], auxUserStoreOperations: [], + threadActivityStoreOperations: [], }, 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 @@ -161,6 +161,7 @@ integrityStoreOperations: [], syncedMetadataStoreOperations: [], auxUserStoreOperations: [], + threadActivityStoreOperations: [], }; if ( 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 @@ -7,6 +7,7 @@ import { messageStoreOpsHandlers } from 'lib/ops/message-store-ops.js'; import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js'; import { syncedMetadataStoreOpsHandlers } from 'lib/ops/synced-metadata-store-ops.js'; +import { threadActivityStoreOpsHandlers } from 'lib/ops/thread-activity-store-ops.js'; import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js'; import { userStoreOpsHandlers } from 'lib/ops/user-store-ops.js'; import { canUseDatabaseOnWeb } from 'lib/shared/web-database.js'; @@ -140,6 +141,7 @@ auxUserStoreOperations, userStoreOperations, messageStoreOperations, + threadActivityStoreOperations, } = storeOperations; const canUseDatabase = canUseDatabaseOnWeb(userID); @@ -165,6 +167,10 @@ userStoreOpsHandlers.convertOpsToClientDBOps(userStoreOperations); const convertedMessageStoreOperations = messageStoreOpsHandlers.convertOpsToClientDBOps(messageStoreOperations); + const convertedThreadActivityStoreOperations = + threadActivityStoreOpsHandlers.convertOpsToClientDBOps( + threadActivityStoreOperations, + ); if ( convertedThreadStoreOperations.length === 0 && @@ -176,7 +182,8 @@ convertedSyncedMetadataStoreOperations.length === 0 && convertedAuxUserStoreOperations.length === 0 && convertedUserStoreOperations.length === 0 && - convertedMessageStoreOperations.length === 0 + convertedMessageStoreOperations.length === 0 && + convertedThreadActivityStoreOperations.length === 0 ) { return; } @@ -200,6 +207,7 @@ auxUserStoreOperations: convertedAuxUserStoreOperations, userStoreOperations: convertedUserStoreOperations, messageStoreOperations: convertedMessageStoreOperations, + threadActivityStoreOperations: convertedThreadActivityStoreOperations, }, }); } catch (e) {