From 0815a96c1d95e25cb083900dcda1b680143f63a0 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 20 Jul 2015 14:15:38 -0700 Subject: [PATCH] Display the new key for verification after a conflict --- js/views/key_conflict_dialogue_view.js | 2 +- js/views/message_detail_view.js | 27 +++++++++++++------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/js/views/key_conflict_dialogue_view.js b/js/views/key_conflict_dialogue_view.js index f1d42813..52fd9e24 100644 --- a/js/views/key_conflict_dialogue_view.js +++ b/js/views/key_conflict_dialogue_view.js @@ -32,7 +32,7 @@ 'click': 'clickOut' }, triggerVerify: function() { - this.trigger('verify', {number: this.model.number}); + this.trigger('verify', {identityKey: this.model.identityKey}); }, clickOut: function(e) { if (!$(e.target).closest('.content').length) { diff --git a/js/views/message_detail_view.js b/js/views/message_detail_view.js index a236cde8..6221e86e 100644 --- a/js/views/message_detail_view.js +++ b/js/views/message_detail_view.js @@ -54,19 +54,18 @@ goBack: function() { this.trigger('back'); }, - verify: function(number) { - var view = new Whisper.KeyVerificationView({ - model: { - their_key: textsecure.storage.axolotl.getIdentityKey(number), - your_key: textsecure.storage.axolotl.getIdentityKey(textsecure.storage.user.getNumber()) - } - }); - this.$el.hide(); - view.render().$el.insertAfter(this.el); - this.listenTo(view, 'back', function() { - view.remove(); - this.$el.show(); - }); + verify: function(their_key) { + textsecure.storage.axolotl.getIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) { + var view = new Whisper.KeyVerificationView({ + model: { their_key: their_key, your_key: our_key } + }); + this.$el.hide(); + view.render().$el.insertAfter(this.el); + this.listenTo(view, 'back', function() { + view.remove(); + this.$el.show(); + }.bind(this)); + }.bind(this)); }, contacts: function() { if (this.model.isIncoming()) { @@ -83,7 +82,7 @@ }); view.render().$el.appendTo(this.$el); this.listenTo(view, 'verify', function(data) { - this.verify(data.number); + this.verify(data.identityKey); }); this.listenTo(view, 'resolve', function() { this.render();