contactSync: mark conversation as secondary when they are

pull/1252/head
Audric Ackermann 5 years ago
parent 3775a9ef05
commit ba7241b2cb
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -340,10 +340,10 @@ async function onContactReceived(details: any) {
} }
const ourPrimaryKey = window.storage.get('primaryDevicePubKey'); const ourPrimaryKey = window.storage.get('primaryDevicePubKey');
if (ourPrimaryKey) { if (ourPrimaryKey) {
const secondaryDevices = await MultiDeviceProtocol.getSecondaryDevices( const ourSecondaryDevices = await MultiDeviceProtocol.getSecondaryDevices(
ourPrimaryKey ourPrimaryKey
); );
if (secondaryDevices.some(device => device.key === id)) { if (ourSecondaryDevices.some(device => device.key === id)) {
await conversation.setSecondaryStatus(true, ourPrimaryKey); await conversation.setSecondaryStatus(true, ourPrimaryKey);
} }
} }
@ -354,6 +354,17 @@ async function onContactReceived(details: any) {
ConversationController.getOrCreateAndWait(d.key, 'private') ConversationController.getOrCreateAndWait(d.key, 'private')
) )
); );
const secondaryDevices = await MultiDeviceProtocol.getSecondaryDevices(id);
await Promise.all(
secondaryDevices.map(async d => {
const secondaryConv = await ConversationController.getOrCreateAndWait(
d.key,
'private'
);
await secondaryConv.setSecondaryStatus(true, id);
})
);
// triger session request with every devices of that user // triger session request with every devices of that user
// when we do not have a session with it already // when we do not have a session with it already
deviceConversations.forEach(device => { deviceConversations.forEach(device => {

Loading…
Cancel
Save