From 93581874b8f9df1ec48617b05bd7d46c8e1ca6cd Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 3 Jun 2020 11:34:40 +1000 Subject: [PATCH] trigger afr to all users devices if needed on contactSync\ --- js/background.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/js/background.js b/js/background.js index 338c82ca8..42475c038 100644 --- a/js/background.js +++ b/js/background.js @@ -1816,12 +1816,21 @@ await conversation.setSecondaryStatus(true, ourPrimaryKey); } - if (conversation.isFriendRequestStatusNoneOrExpired()) { - libloki.api.sendAutoFriendRequestMessage(conversation.id); - } else { - // Accept any pending friend requests if there are any - conversation.onAcceptFriendRequest({ blockSync: true }); - } + const otherDevices = await libloki.storage.getPairedDevicesFor(id); + const devices = [id, ...otherDevices]; + const deviceConversations = await Promise.all(devices.map(d => ConversationController.getOrCreateAndWait( + d, + 'private' + ))); + deviceConversations.forEach(device => { + if (device.isFriendRequestStatusNoneOrExpired()) { + libloki.api.sendAutoFriendRequestMessage(device.id); + } else { + // Accept any pending friend requests if there are any + device.onAcceptFriendRequest({ blockSync: true }); + } + }); + if (details.profileKey) { const profileKey = window.Signal.Crypto.arrayBufferToBase64(