|
|
@ -350,12 +350,14 @@ OutgoingMessage.prototype = {
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
// do nothing
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
if (conversation && !this.isGroup) {
|
|
|
|
conversation &&
|
|
|
|
const isOurDevice = await conversation.isOurDevice();
|
|
|
|
!conversation.isFriend() &&
|
|
|
|
const isFriends =
|
|
|
|
!conversation.hasReceivedFriendRequest() &&
|
|
|
|
conversation.isFriend() ||
|
|
|
|
!this.isGroup
|
|
|
|
conversation.hasReceivedFriendRequest();
|
|
|
|
) {
|
|
|
|
// We should only send a friend request to our device if we don't have keys
|
|
|
|
|
|
|
|
const shouldSendAutomatedFR = isOurDevice ? !keysFound : !isFriends;
|
|
|
|
|
|
|
|
if (shouldSendAutomatedFR) {
|
|
|
|
// We want to send an automated friend request if:
|
|
|
|
// We want to send an automated friend request if:
|
|
|
|
// - We aren't already friends
|
|
|
|
// - We aren't already friends
|
|
|
|
// - We haven't received a friend request from this device
|
|
|
|
// - We haven't received a friend request from this device
|
|
|
@ -369,6 +371,14 @@ OutgoingMessage.prototype = {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If we're not friends with our own device then we should become friends
|
|
|
|
|
|
|
|
if (isOurDevice && keysFound && !isFriends) {
|
|
|
|
|
|
|
|
conversation.setFriendRequestStatus(
|
|
|
|
|
|
|
|
window.friends.friendRequestStatusEnum.friends
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check if we need to attach the preKeys
|
|
|
|
// Check if we need to attach the preKeys
|
|
|
|