diff --git a/lib/reducers/db-ops-reducer.js b/lib/reducers/db-ops-reducer.js --- a/lib/reducers/db-ops-reducer.js +++ b/lib/reducers/db-ops-reducer.js @@ -6,6 +6,7 @@ import type { MessageStoreOperation } from '../ops/message-store-ops.js'; import type { DBOpsStore } from '../types/db-ops-types.js'; import { messageTypes } from '../types/message-types-enum.js'; +import type { NotificationsCreationData } from '../types/notif-types.js'; import type { BaseAction, DispatchMetadata } from '../types/redux-types.js'; import type { StoreOperations } from '../types/store-ops-types.js'; import { values } from '../utils/objects.js'; @@ -18,7 +19,6 @@ queuedOps: rest, }; } - return store; } @@ -69,6 +69,7 @@ store: DBOpsStore, dispatchMetadata: ?DispatchMetadata, inputOps: StoreOperations, + notificationsCreationData: ?NotificationsCreationData, ): DBOpsStore { const areNewOpsPresent = values(inputOps).some( opsArray => opsArray.length > 0, @@ -85,19 +86,23 @@ messageSearchStoreOperations, }; - if (dispatchMetadata && areNewOpsPresent) { + if (dispatchMetadata && areNewOpsPresent && notificationsCreationData) { newEntry = { dispatchMetadata, ops, + notificationsCreationData, }; - } else if (areNewOpsPresent) { + } else if (dispatchMetadata && areNewOpsPresent) { newEntry = { + dispatchMetadata, ops, }; - } else if (dispatchMetadata) { + } else if (areNewOpsPresent) { newEntry = { - dispatchMetadata, + ops, }; + } else if (dispatchMetadata) { + newEntry = { dispatchMetadata }; } if (!newEntry) { diff --git a/lib/types/db-ops-types.js b/lib/types/db-ops-types.js --- a/lib/types/db-ops-types.js +++ b/lib/types/db-ops-types.js @@ -1,5 +1,6 @@ // @flow +import type { NotificationsCreationData } from './notif-types.js'; import { type DispatchMetadata } from './redux-types.js'; import type { StoreOperations } from './store-ops-types.js'; @@ -7,6 +8,7 @@ | { +dispatchMetadata: DispatchMetadata, +ops?: ?StoreOperations, + +notificationsCreationData?: NotificationsCreationData, } | { +ops: StoreOperations, diff --git a/lib/types/dm-ops.js b/lib/types/dm-ops.js --- a/lib/types/dm-ops.js +++ b/lib/types/dm-ops.js @@ -4,6 +4,7 @@ import { clientAvatarValidator, type ClientAvatar } from './avatar-types.js'; import type { RawMessageInfo } from './message-types.js'; +import type { NotificationsCreationData } from './notif-types.js'; import type { OutboundP2PMessage } from './sqlite-types.js'; import { type NonSidebarThickThreadType, @@ -363,6 +364,7 @@ // with `outboundP2PMessages` to keep track of whether all P2P messages // were queued on Tunnelbroker. +messageIDWithoutAutoRetry: ?string, + +notificationsCreationData: ?NotificationsCreationData, }; export const queueDMOpsActionType = 'QUEUE_DM_OPS'; 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 @@ -28,6 +28,7 @@ identityInvalidSessionDowngrade, } from 'lib/shared/session-utils.js'; import { isStaff } from 'lib/shared/staff-utils.js'; +import { processDMOpsActionType } from 'lib/types/dm-ops.js'; import type { Dispatch, BaseAction } from 'lib/types/redux-types.js'; import { rehydrateActionType } from 'lib/types/redux-types.js'; import type { SetSessionPayload } from 'lib/types/session-types.js'; @@ -312,9 +313,20 @@ ...storeOperations, threadStoreOperations: threadStoreOperationsWithUnreadFix, }; + + let notificationsCreationData = null; + if (action.type === processDMOpsActionType) { + notificationsCreationData = action.payload.notificationsCreationData; + } + state = { ...state, - dbOpsStore: queueDBOps(state.dbOpsStore, action.dispatchMetadata, ops), + dbOpsStore: queueDBOps( + state.dbOpsStore, + action.dispatchMetadata, + ops, + notificationsCreationData, + ), }; return state; 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 @@ -39,6 +39,7 @@ import type { CommunityStore } from 'lib/types/community-types.js'; import type { DBOpsStore } from 'lib/types/db-ops-types.js'; import type { QueuedDMOperations } from 'lib/types/dm-ops.js'; +import { processDMOpsActionType } from 'lib/types/dm-ops.js'; import type { DraftStore } from 'lib/types/draft-types.js'; import type { EnabledApps } from 'lib/types/enabled-apps.js'; import type { EntryStore } from 'lib/types/entry-types.js'; @@ -539,12 +540,18 @@ return state; } + let notificationsCreationData = null; + if (action.type === processDMOpsActionType) { + notificationsCreationData = action.payload.notificationsCreationData; + } + return { ...state, dbOpsStore: queueDBOps( state.dbOpsStore, action.dispatchMetadata, storeOperations, + notificationsCreationData, ), }; }