2015-09-07 21:53:43 +00:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-09-03 20:33:17 +00:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
|
|
|
Whisper.ContactListView = Whisper.ListView.extend({
|
|
|
|
tagName: 'div',
|
|
|
|
itemView: Whisper.View.extend({
|
|
|
|
tagName: 'div',
|
|
|
|
className: 'contact',
|
2015-12-08 23:01:29 +00:00
|
|
|
templateName: 'contact',
|
2017-06-10 19:18:24 +00:00
|
|
|
events: {
|
|
|
|
'click': 'showIdentity'
|
|
|
|
},
|
|
|
|
initialize: function(options) {
|
|
|
|
this.ourNumber = textsecure.storage.user.getNumber();
|
|
|
|
this.listenBack = options.listenBack;
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change', this.render);
|
|
|
|
},
|
2015-09-03 20:33:17 +00:00
|
|
|
render_attributes: function() {
|
2017-06-10 19:18:24 +00:00
|
|
|
if (this.model.id === this.ourNumber) {
|
|
|
|
return {
|
|
|
|
class: 'not-clickable',
|
|
|
|
title: i18n('me'),
|
|
|
|
number: this.model.getNumber(),
|
|
|
|
avatar: this.model.getAvatar()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-09-03 20:33:17 +00:00
|
|
|
return {
|
|
|
|
title: this.model.getTitle(),
|
|
|
|
number: this.model.getNumber(),
|
2017-06-10 19:18:24 +00:00
|
|
|
avatar: this.model.getAvatar(),
|
2017-06-14 19:29:32 +00:00
|
|
|
isVerified: this.model.isVerified(),
|
|
|
|
verified: i18n('verified')
|
2015-09-03 20:33:17 +00:00
|
|
|
};
|
2017-06-10 19:18:24 +00:00
|
|
|
},
|
|
|
|
showIdentity: function() {
|
|
|
|
if (this.model.id === this.ourNumber) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var view = new Whisper.KeyVerificationPanelView({
|
|
|
|
model: this.model
|
|
|
|
});
|
|
|
|
this.listenBack(view);
|
2015-09-03 20:33:17 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})();
|