Fix friend request logic triggerring on session requests

pull/843/head
Mikunj Varsani 5 years ago
parent 8ffb1a0a10
commit ebfff824bd

@ -391,6 +391,8 @@ OutgoingMessage.prototype = {
: null; : null;
const isEndSession = const isEndSession =
flags === textsecure.protobuf.DataMessage.Flags.END_SESSION; flags === textsecure.protobuf.DataMessage.Flags.END_SESSION;
const isSessionRequest =
flags === textsecure.protobuf.DataMessage.Flags.SESSION_REQUEST;
const signalCipher = new libsignal.SessionCipher( const signalCipher = new libsignal.SessionCipher(
textsecure.storage.protocol, textsecure.storage.protocol,
address address
@ -485,6 +487,7 @@ OutgoingMessage.prototype = {
content, content,
pubKey: devicePubKey, pubKey: devicePubKey,
isFriendRequest: enableFallBackEncryption, isFriendRequest: enableFallBackEncryption,
isSessionRequest,
}; };
}) })
) )
@ -494,7 +497,12 @@ OutgoingMessage.prototype = {
if (!outgoingObject) { if (!outgoingObject) {
return; return;
} }
const destination = outgoingObject.pubKey; const {
pubKey: destination,
ttl,
isFriendRequest,
isSessionRequest,
} = outgoingObject;
try { try {
const socketMessage = await this.wrapInWebsocketMessage( const socketMessage = await this.wrapInWebsocketMessage(
outgoingObject outgoingObject
@ -503,9 +511,9 @@ OutgoingMessage.prototype = {
destination, destination,
socketMessage, socketMessage,
this.timestamp, this.timestamp,
outgoingObject.ttl ttl
); );
if (outgoingObject.isFriendRequest) { if (!this.isGroup && isFriendRequest && !isSessionRequest) {
const conversation = ConversationController.get(destination); const conversation = ConversationController.get(destination);
if (conversation) { if (conversation) {
// Redundant for primary device but marks secondary devices as pending // Redundant for primary device but marks secondary devices as pending

Loading…
Cancel
Save