diff --git a/lib/shared/dm-ops/dm-op-utils.js b/lib/shared/dm-ops/dm-op-utils.js --- a/lib/shared/dm-ops/dm-op-utils.js +++ b/lib/shared/dm-ops/dm-op-utils.js @@ -55,7 +55,9 @@ export type DMOperationSpecification = { +op: DMOperation, +supportsAutoRetry: boolean, - +recipients: 'all_peer_devices' | 'self_devices', + +recipients: + | { +type: 'all_peer_devices' | 'self_devices' } + | { +type: 'some_users', +userIDs: $ReadOnlyArray }, }; async function createMessagesToPeersFromDMOp( @@ -71,10 +73,15 @@ } let peerUserIDAndDeviceIDs = allPeerUserIDAndDeviceIDs; - if (operation.recipients === 'self_devices') { + if (operation.recipients.type === 'self_devices') { peerUserIDAndDeviceIDs = allPeerUserIDAndDeviceIDs.filter( peer => peer.userID === currentUserInfo.id, ); + } else if (operation.recipients.type === 'some_users') { + const userIDs = new Set(operation.recipients.userIDs); + peerUserIDAndDeviceIDs = allPeerUserIDAndDeviceIDs.filter(peer => + userIDs.has(peer.userID), + ); } const thisDeviceID = await getContentSigningKey();