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 @@ -33,6 +33,9 @@ +isProcessingPossible: false, +reason: | { +type: 'missing_thread', +threadID: string } + | { +type: 'missing_entry', +entryID: string } + | { +type: 'missing_message', +messageID: string } + | { +type: 'missing_membership', +threadID: string, +userID: string } | { +type: 'invalid' }, }, +supportsAutoRetry: boolean, 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 @@ -148,22 +148,43 @@ utilities, ); if (!processingCheckResult.isProcessingPossible) { + if (processingCheckResult.reason.type === 'invalid') { + return; + } + let condition; if (processingCheckResult.reason.type === 'missing_thread') { - dispatchWithMetadata( - { - type: queueDMOpsActionType, - payload: { - operation: dmOp, - timestamp: Date.now(), - condition: { - type: 'thread', - threadID: processingCheckResult.reason.threadID, - }, - }, - }, - dispatchMetadata, - ); + condition = { + type: 'thread', + threadID: processingCheckResult.reason.threadID, + }; + } else if (processingCheckResult.reason.type === 'missing_entry') { + condition = { + type: 'entry', + entryID: processingCheckResult.reason.entryID, + }; + } else if (processingCheckResult.reason.type === 'missing_message') { + condition = { + type: 'message', + messageID: processingCheckResult.reason.messageID, + }; + } else if (processingCheckResult.reason.type === 'missing_membership') { + condition = { + type: 'membership', + threadID: processingCheckResult.reason.threadID, + userID: processingCheckResult.reason.userID, + }; } + dispatchWithMetadata( + { + type: queueDMOpsActionType, + payload: { + operation: dmOp, + timestamp: Date.now(), + condition, + }, + }, + dispatchMetadata, + ); return; }