2015-09-07 21:53:43 +00:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-02-18 02:03:05 +00:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2015-12-08 23:01:29 +00:00
|
|
|
Whisper.KeyConflictDialogueView = Whisper.View.extend({
|
|
|
|
templateName: 'key-conflict-dialogue',
|
2016-02-17 19:59:20 +00:00
|
|
|
className: 'key-conflict-dialogue clearfix',
|
2015-02-18 02:03:05 +00:00
|
|
|
initialize: function(options) {
|
2016-02-17 19:59:20 +00:00
|
|
|
this.contact = options.contact;
|
2015-02-18 02:03:05 +00:00
|
|
|
this.conversation = options.conversation;
|
2016-09-18 01:59:22 +00:00
|
|
|
this.render();
|
|
|
|
var view = new Whisper.KeyVerificationView({
|
2016-09-18 22:16:39 +00:00
|
|
|
model : this.contact,
|
|
|
|
newKey : this.model.identityKey
|
2016-09-18 01:59:22 +00:00
|
|
|
});
|
|
|
|
view.$el.appendTo(this.$('.keys'));
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
|
|
|
events: {
|
2016-03-23 19:33:50 +00:00
|
|
|
'click .showKeys': 'showKeys',
|
|
|
|
'click .hideKeys': 'hideKeys',
|
2016-02-17 19:59:20 +00:00
|
|
|
'click .resolve' : 'resolve'
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
2016-03-23 19:33:50 +00:00
|
|
|
hideKeys: function() {
|
|
|
|
this.$('.keys, .hideKeys').hide();
|
|
|
|
this.$('.showKeys').show();
|
|
|
|
},
|
|
|
|
showKeys: function() {
|
|
|
|
this.$('.keys, .hideKeys').show();
|
|
|
|
this.$('.showKeys').hide();
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
|
|
|
resolve: function() {
|
|
|
|
this.remove();
|
2015-09-15 18:02:17 +00:00
|
|
|
this.conversation.resolveConflicts(this.model);
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
2015-12-08 23:01:29 +00:00
|
|
|
render_attributes: function() {
|
2015-12-26 06:47:09 +00:00
|
|
|
return {
|
2016-02-17 19:59:20 +00:00
|
|
|
name : this.contact.getTitle(),
|
|
|
|
avatar : this.contact.getAvatar(),
|
2016-03-23 19:33:50 +00:00
|
|
|
conflict : this.model,
|
2016-02-17 19:59:20 +00:00
|
|
|
newIdentity : i18n('newIdentity'),
|
|
|
|
message : i18n('identityChanged'),
|
|
|
|
resolve : i18n('acceptNewKey'),
|
2016-03-23 19:33:50 +00:00
|
|
|
showKeys : i18n('showMore'),
|
2016-03-24 19:33:41 +00:00
|
|
|
hideKeys : i18n('showLess'),
|
|
|
|
learnMore : i18n('learnMore')
|
2015-12-26 06:47:09 +00:00
|
|
|
};
|
2015-02-18 02:03:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|