Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3508518
D13205.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13205.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13205: [lib] Extract user ids from DM ops
Attached
Detach File
Event Timeline
Log In to Comment