Fix device unlinking.

Fix session request being sent even if we have keys to setup a session.
Fix minor crash.
pull/834/head
Mikunj Varsani 6 years ago
parent e1d06fc9be
commit a75ef365b8

@ -205,7 +205,7 @@
}, },
getLokiNameForNumber(number) { getLokiNameForNumber(number) {
const conversation = ConversationController.get(number); const conversation = ConversationController.get(number);
if (!conversation) { if (!conversation || !conversation.getLokiProfile()) {
return number; return number;
} }
return conversation.getLokiProfile().displayName; return conversation.getLokiProfile().displayName;

@ -1314,8 +1314,9 @@ MessageReceiver.prototype.extend({
primaryPubKey primaryPubKey
); );
// If we don't have a mapping on the primary then we have been unlinked
if (!primaryMapping) { if (!primaryMapping) {
return false; return true;
} }
// We expect the primary device to have updated its mapping // We expect the primary device to have updated its mapping

@ -411,7 +411,7 @@ MessageSender.prototype = {
const ourNumber = textsecure.storage.user.getNumber(); const ourNumber = textsecure.storage.user.getNumber();
numbers.forEach(number => { numbers.forEach(async number => {
// Note: if we are sending a private group message, we do our best to // Note: if we are sending a private group message, we do our best to
// ensure we have signal protocol sessions with every member, but if we // ensure we have signal protocol sessions with every member, but if we
// fail, let's at least send messages to those members with which we do: // fail, let's at least send messages to those members with which we do:
@ -420,9 +420,17 @@ MessageSender.prototype = {
s => s.number === number s => s.number === number
); );
let keysFound = false;
// If we don't have a session but we already have prekeys to
// start communication then we should use them
if (!haveSession && !options.isPublic) {
keysFound = await outgoing.getKeysForNumber(number, []);
}
if ( if (
number === ourNumber || number === ourNumber ||
haveSession || haveSession ||
keysFound ||
options.isPublic || options.isPublic ||
options.messageType === 'friend-request' options.messageType === 'friend-request'
) { ) {

@ -1241,6 +1241,7 @@
margin: 10px auto; margin: 10px auto;
padding: 5px 20px; padding: 5px 20px;
border-radius: 4px; border-radius: 4px;
word-break: break-word;
} }
.module-group-notification__contact { .module-group-notification__contact {

@ -38,7 +38,7 @@ export class GroupNotification extends React.Component<Props> {
key={`external-${contact.phoneNumber}`} key={`external-${contact.phoneNumber}`}
className="module-group-notification__contact" className="module-group-notification__contact"
> >
{contact.profileName} {contact.profileName || contact.phoneNumber}
</span> </span>
); );

@ -56,9 +56,10 @@ export class SessionClosableOverlay extends React.Component<Props, State> {
const conversationList = conversations.filter((conversation: any) => { const conversationList = conversations.filter((conversation: any) => {
// TODO: We need to handle the case with > 1 secondary device // TODO: We need to handle the case with > 1 secondary device
const isOurDevice = conversation.isMe() || conversation.isOurConversation(); const isOurDevice =
conversation.isMe() || conversation.isOurConversation();
return ( return (
!isOurDevice&& !isOurDevice &&
conversation.isPrivate() && conversation.isPrivate() &&
!conversation.isSecondaryDevice() && !conversation.isSecondaryDevice() &&
conversation.isFriend() conversation.isFriend()

Loading…
Cancel
Save