diff --git a/js/libtextsecure.js b/js/libtextsecure.js index ccffbb5cf8..f41c009a10 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -39186,13 +39186,7 @@ MessageSender.prototype = { }, getProfile: function(number) { - return this.server.getProfile(number).then(function(profile) { - var identityKey = dcodeIO.ByteBuffer.wrap(profile.identityKey).toArrayBuffer(); - - return textsecure.storage.protocol.isTrusted(number, identityKey).then(function(trusted) { - - }); - }); + return this.server.getProfile(number); }, sendRequestGroupSyncMessage: function() { diff --git a/js/models/conversations.js b/js/models/conversations.js index 06f156174a..5e2b82e97b 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -339,6 +339,27 @@ }.bind(this)); }, + getProfiles: function() { + // request all conversation members' keys + var ids = []; + if (this.isPrivate()) { + ids = [this.id]; + } else { + ids = this.get('members'); + } + ids.forEach(this.getProfile); + }, + + getProfile: function(id) { + return textsecure.messaging.getProfile(id).then(function(profile) { + var identityKey = dcodeIO.ByteBuffer.wrap(profile.identityKey, 'base64').toArrayBuffer(); + + return textsecure.storage.protocol.saveIdentity( + id, identityKey, storage.get('safety-numbers-approval', true), false + ); + }); + }, + fetchMessages: function() { if (!this.id) { return false; } return this.messageCollection.fetchConversation(this.id, null, this.get('unreadCount')); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 8f7dbdbae6..ce89d38319 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -230,6 +230,8 @@ }, onOpened: function() { + this.model.getProfiles(); + this.view.resetScrollPosition(); this.$el.trigger('force-resize'); this.focusMessageField(); diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index fb1e181be1..77a6573350 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -255,13 +255,7 @@ MessageSender.prototype = { }, getProfile: function(number) { - return this.server.getProfile(number).then(function(profile) { - var identityKey = dcodeIO.ByteBuffer.wrap(profile.identityKey).toArrayBuffer(); - - return textsecure.storage.protocol.isTrusted(number, identityKey).then(function(trusted) { - - }); - }); + return this.server.getProfile(number); }, sendRequestGroupSyncMessage: function() {