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;
|
|
|
|
this.conflict = options.conflict;
|
2015-02-18 02:03:05 +00:00
|
|
|
this.conversation = options.conversation;
|
|
|
|
},
|
|
|
|
events: {
|
2016-02-17 19:59:20 +00:00
|
|
|
'click .conflict': 'showDialog',
|
|
|
|
'click .cancel' : 'cancel',
|
|
|
|
'click .verify' : 'triggerVerify',
|
|
|
|
'click .resolve' : 'resolve'
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
|
|
|
triggerVerify: function() {
|
2015-07-20 21:15:38 +00:00
|
|
|
this.trigger('verify', {identityKey: this.model.identityKey});
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
|
|
|
resolve: function() {
|
|
|
|
this.trigger('resolve');
|
|
|
|
this.remove();
|
2015-09-15 18:02:17 +00:00
|
|
|
this.conversation.resolveConflicts(this.model);
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
2016-02-17 19:59:20 +00:00
|
|
|
showDialog: function() {
|
|
|
|
this.$('.conflict').hide();
|
|
|
|
this.$('.cancel, .content').show();
|
|
|
|
},
|
|
|
|
cancel: function() {
|
|
|
|
this.$('.cancel, .content').hide();
|
|
|
|
this.$('.conflict').show();
|
|
|
|
},
|
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(),
|
|
|
|
conflict : this.conflict,
|
|
|
|
verify : i18n('verify'),
|
|
|
|
cancel : i18n('cancel'),
|
|
|
|
newIdentity : i18n('newIdentity'),
|
|
|
|
message : i18n('identityChanged'),
|
|
|
|
resolve : i18n('acceptNewKey'),
|
2015-12-26 06:47:09 +00:00
|
|
|
verifyContact: i18n('verifyContact')
|
|
|
|
};
|
2015-02-18 02:03:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|