Page MenuHomePhabricator

D13157.id43657.diff
No OneTemporary

D13157.id43657.diff

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
@@ -26,6 +26,7 @@
type SendDMOpsSuccessPayload,
} from '../../types/dm-ops.js';
import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
+import type { DispatchMetadata } from '../../types/redux-types.js';
import type { OutboundP2PMessage } from '../../types/sqlite-types.js';
import { threadTypes } from '../../types/thread-types-enum.js';
import type { LegacyRawThreadInfo } from '../../types/thread-types.js';
@@ -37,6 +38,7 @@
function useProcessDMOperation(): (
dmOperationSpecification: DMOperationSpecification,
+ dmOpID: ?string,
) => Promise<void> {
const fetchMessage = useGetLatestMessageEdit();
const threadInfos = useSelector(state => state.threadStore.threadInfos);
@@ -56,7 +58,10 @@
const currentUserInfo = useSelector(state => state.currentUserInfo);
return React.useCallback(
- async (dmOperationSpecification: DMOperationSpecification) => {
+ async (
+ dmOperationSpecification: DMOperationSpecification,
+ dmOpID: ?string,
+ ) => {
if (!viewerID) {
console.log('ignored DMOperation because logged out');
return;
@@ -73,7 +78,22 @@
);
}
- const { op: dmOp, metadata } = dmOperationSpecification;
+ let dispatchMetadata: ?DispatchMetadata = null;
+ if (
+ dmOperationSpecification.type ===
+ dmOperationSpecificationTypes.OUTBOUND &&
+ dmOpID
+ ) {
+ dispatchMetadata = {
+ dmOpID,
+ };
+ } else if (
+ dmOperationSpecification.type === dmOperationSpecificationTypes.INBOUND
+ ) {
+ dispatchMetadata = dmOperationSpecification.metadata;
+ }
+
+ const { op: dmOp } = dmOperationSpecification;
const processingCheckResult = dmOpSpecs[dmOp.type].canBeProcessed(
dmOp,
viewerID,
@@ -90,7 +110,7 @@
timestamp: Date.now(),
},
},
- metadata,
+ dispatchMetadata,
);
}
return;
@@ -184,7 +204,7 @@
messageIDWithoutAutoRetry,
},
},
- metadata,
+ dispatchMetadata,
);
},
[
@@ -207,8 +227,8 @@
return React.useCallback(
async (dmOperationSpecification: OutboundDMOperationSpecification) => {
- const { promise } = getDMOpsSendingPromise();
- await processDMOps(dmOperationSpecification);
+ const { promise, dmOpID } = getDMOpsSendingPromise();
+ await processDMOps(dmOperationSpecification, dmOpID);
if (
dmOperationSpecification.type ===

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 8:57 PM (20 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2325613
Default Alt Text
D13157.id43657.diff (2 KB)

Event Timeline