diff --git a/lib/shared/dm-ops/process-dm-ops.js b/lib/shared/dm-ops/process-dm-ops.js --- a/lib/shared/dm-ops/process-dm-ops.js +++ b/lib/shared/dm-ops/process-dm-ops.js @@ -332,6 +332,8 @@ const allPeerUserIDAndDeviceIDs = useSelector(getAllPeerUserIDAndDeviceIDs); const currentUserInfo = useSelector(state => state.currentUserInfo); const utilities = useSendDMOperationUtils(); + const { processOutboundMessages } = usePeerToPeerCommunication(); + const localMessageInfos = useSelector(state => state.messageStore.local); return React.useCallback( async ( @@ -341,6 +343,15 @@ const { op, composableMessageID, recipients } = dmOperationSpecification; + const localMessageInfo = localMessageInfos[composableMessageID]; + if ( + localMessageInfo?.outboundP2PMessageIDs && + localMessageInfo.outboundP2PMessageIDs.length > 0 + ) { + processOutboundMessages(localMessageInfo.outboundP2PMessageIDs, dmOpID); + return promise; + } + const outboundP2PMessages = await createMessagesToPeersFromDMOp( op, recipients, @@ -376,6 +387,8 @@ currentUserInfo, dispatchWithMetadata, getDMOpsSendingPromise, + localMessageInfos, + processOutboundMessages, threadInfos, utilities, ],