Page MenuHomePhabricator

D13205.diff
No OneTemporary

D13205.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
@@ -13,6 +13,7 @@
createMessagesToPeersFromDMOp,
dmOperationSpecificationTypes,
} from './dm-op-utils.js';
+import { processNewUserIDsActionType } from '../../actions/user-actions.js';
import { useLoggedInUserInfo } from '../../hooks/account-hooks.js';
import { useGetLatestMessageEdit } from '../../hooks/latest-message-edit.js';
import { useDispatchWithMetadata } from '../../hooks/ops-hooks.js';
@@ -25,6 +26,7 @@
sendDMActionTypes,
type SendDMOpsSuccessPayload,
} from '../../types/dm-ops.js';
+import { dmOperationValidator } from '../../types/dm-ops.js';
import type { LocalMessageInfo } from '../../types/message-types.js';
import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
import type { DispatchMetadata } from '../../types/redux-types.js';
@@ -32,8 +34,9 @@
import { threadTypes } from '../../types/thread-types-enum.js';
import type { LegacyRawThreadInfo } from '../../types/thread-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
+import { extractUserIDsFromPayload } from '../../utils/conversion-utils.js';
import { useDispatchActionPromise } from '../../utils/redux-promise-utils.js';
-import { useSelector } from '../../utils/redux-utils.js';
+import { useSelector, useDispatch } from '../../utils/redux-utils.js';
import { messageSpecs } from '../messages/message-specs.js';
import { updateSpecs } from '../updates/update-specs.js';
@@ -58,6 +61,8 @@
const allPeerUserIDAndDeviceIDs = useSelector(getAllPeerUserIDAndDeviceIDs);
const currentUserInfo = useSelector(state => state.currentUserInfo);
+ const dispatch = useDispatch();
+
return React.useCallback(
async (
dmOperationSpecification: DMOperationSpecification,
@@ -154,6 +159,14 @@
return;
}
+ const newUserIDs = extractUserIDsFromPayload(dmOperationValidator, dmOp);
+ if (newUserIDs.length > 0) {
+ dispatch({
+ type: processNewUserIDsActionType,
+ payload: { userIDs: newUserIDs },
+ });
+ }
+
const dmOpSpec = dmOpSpecs[dmOp.type];
const notificationsCreationDataPromise = (async () => {
return await dmOpSpec.notificationsCreationData?.(dmOp, utilities);
@@ -252,6 +265,7 @@
allPeerUserIDAndDeviceIDs,
currentUserInfo,
threadInfos,
+ dispatch,
],
);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 10:40 PM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2689767
Default Alt Text
D13205.diff (2 KB)

Event Timeline