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 @@ -26,8 +26,10 @@ ops: { outboundP2PMessages: action.payload.messages, }, + notificationsCreationData: action.payload.notificationsCreationData, dmOpID: action.payload.dmOpID, }; + return { ...store, queuedOps: [...store.queuedOps, newEntry], diff --git a/lib/shared/dm-ops/dm-op-spec.js b/lib/shared/dm-ops/dm-op-spec.js --- a/lib/shared/dm-ops/dm-op-spec.js +++ b/lib/shared/dm-ops/dm-op-spec.js @@ -2,6 +2,7 @@ import type { DMOperation, DMOperationResult } from '../../types/dm-ops.js'; import type { RawMessageInfo } from '../../types/message-types.js'; +import type { NotificationsCreationData } from '../../types/notif-types.js'; import type { RawThreadInfos } from '../../types/thread-types.js'; export type ProcessDMOperationUtilities = { @@ -26,4 +27,5 @@ +isProcessingPossible: false, +reason: { +type: 'missing_thread', +threadID: string }, }, + +notificationsCreationData?: (dmOp: DMOp) => NotificationsCreationData, }; diff --git a/lib/tunnelbroker/peer-to-peer-context.js b/lib/tunnelbroker/peer-to-peer-context.js --- a/lib/tunnelbroker/peer-to-peer-context.js +++ b/lib/tunnelbroker/peer-to-peer-context.js @@ -9,6 +9,7 @@ useTunnelbroker, } from './tunnelbroker-context.js'; import { usePeerOlmSessionsCreatorContext } from '../components/peer-olm-session-creator-provider.react.js'; +import { dmOpSpecs } from '../shared/dm-ops/dm-op-specs.js'; import { createMessagesToPeersFromDMOp, type DMOperationSpecification, @@ -184,11 +185,20 @@ auxUserStore, currentUserInfo, ); + + const { + op: { type }, + } = op; + const notificationsCreationData = dmOpSpecs[ + type + ].notificationsCreationData?.(op.op); + dispatch({ type: scheduleP2PMessagesActionType, payload: { dmOpID, messages, + notificationsCreationData, }, }); 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, @@ -323,6 +324,7 @@ export type ScheduleP2PMessagesPayload = { +dmOpID: string, +messages: $ReadOnlyArray, + +notificationsCreationData?: NotificationsCreationData, }; export const clearQueuedThreadDMOpsActionType = 'CLEAR_QUEUED_THREAD_DM_OPS';