diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js --- a/lib/reducers/calendar-filters-reducer.js +++ b/lib/reducers/calendar-filters-reducer.js @@ -27,6 +27,7 @@ } from '../selectors/calendar-filter-selectors.js'; import { threadInFilterList } from '../shared/thread-utils.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; +import { processDMOpsActionType } from '../types/dm-ops.js'; import { type CalendarFilter, defaultCalendarFilters, @@ -156,6 +157,8 @@ } else if (action.type === clearCalendarCommunityFilter) { const nonThreadFilters = nonThreadCalendarFilters(state); return nonThreadFilters; + } else if (action.type === processDMOpsActionType) { + return updateFilterListFromUpdateInfos(state, action.payload.updateInfos); } return state; } diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -47,6 +47,7 @@ import { threadInFilterList } from '../shared/thread-utils.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; import { isWebPlatform } from '../types/device-types.js'; +import { processDMOpsActionType } from '../types/dm-ops.js'; import type { RawEntryInfo, EntryStore } from '../types/entry-types.js'; import type { BaseAction } from '../types/redux-types.js'; import { type ClientEntryInconsistencyReportCreationRequest } from '../types/report-types.js'; @@ -774,6 +775,18 @@ entryStoreOperations: [], reportCreationRequests: [], }; + } else if (action.type === processDMOpsActionType) { + const ops = mergeNewEntryInfosOps( + entryInfos, + daysToEntries, + mergeUpdateEntryInfos([], action.payload.updateInfos), + newThreadInfos, + ); + return { + entryStore: entryStoreOpsHandlers.processStoreOperations(entryStore, ops), + entryStoreOperations: ops, + reportCreationRequests: [], + }; } return { entryStore, 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 @@ -78,6 +78,7 @@ import { unshimMessageInfos } from '../shared/unshim-utils.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; import { recoveryFromReduxActionSources } from '../types/account-types.js'; +import { processDMOpsActionType } from '../types/dm-ops.js'; import type { Media, Image } from '../types/media-types.js'; import { messageTypes } from '../types/message-types-enum.js'; import { @@ -1814,6 +1815,24 @@ messageStoreOperations, messageStore: processedMessageStore, }; + } else if (action.type === processDMOpsActionType) { + const { rawMessageInfos, updateInfos } = action.payload; + if (rawMessageInfos.length === 0 && updateInfos.length === 0) { + return { messageStoreOperations: [], messageStore }; + } + + const messagesResult = mergeUpdatesWithMessageInfos( + rawMessageInfos, + updateInfos, + {}, + ); + + return mergeNewMessages( + messageStore, + messagesResult.rawMessageInfos, + messagesResult.truncationStatuses, + newThreadInfos, + ); } return { messageStoreOperations: [], messageStore }; } diff --git a/lib/reducers/thread-activity-reducer.js b/lib/reducers/thread-activity-reducer.js --- a/lib/reducers/thread-activity-reducer.js +++ b/lib/reducers/thread-activity-reducer.js @@ -24,6 +24,7 @@ type ThreadActivityStoreOperation, } from '../ops/thread-activity-store-ops.js'; import { isWebPlatform } from '../types/device-types.js'; +import { processDMOpsActionType } from '../types/dm-ops.js'; import type { BaseAction } from '../types/redux-types.js'; import { incrementalStateSyncActionType, @@ -239,6 +240,8 @@ threadActivityStore: state, threadActivityStoreOperations: [], }; + } else if (action.type === processDMOpsActionType) { + return handleThreadDeletionUpdates(state, action.payload.updateInfos); } return { threadActivityStore: state, diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -37,6 +37,7 @@ } from '../ops/thread-store-ops.js'; import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; +import { processDMOpsActionType } from '../types/dm-ops.js'; import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAction } from '../types/redux-types.js'; import { type ClientThreadInconsistencyReportCreationRequest } from '../types/report-types.js'; @@ -534,6 +535,28 @@ newThreadInconsistencies: [], threadStoreOperations: [], }; + } else if (action.type === processDMOpsActionType) { + const { updateInfos } = action.payload; + if (updateInfos.length === 0) { + return { + threadStore: state, + newThreadInconsistencies: [], + threadStoreOperations: [], + }; + } + const threadStoreOperations = generateOpsForThreadUpdates( + state.threadInfos, + updateInfos, + ); + const updatedThreadStore = processThreadStoreOperations( + state, + threadStoreOperations, + ); + return { + threadStore: updatedThreadStore, + newThreadInconsistencies: [], + threadStoreOperations, + }; } return { threadStore: state,