2018-04-27 21:25:04 +00:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
window.Whisper = window.Whisper || {};
|
2015-09-03 20:33:17 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
Whisper.ContactListView = Whisper.ListView.extend({
|
|
|
|
tagName: 'div',
|
|
|
|
itemView: Whisper.View.extend({
|
|
|
|
tagName: 'div',
|
|
|
|
className: 'contact',
|
|
|
|
templateName: 'contact',
|
|
|
|
events: {
|
|
|
|
click: 'showIdentity',
|
|
|
|
},
|
|
|
|
initialize: function(options) {
|
|
|
|
this.ourNumber = textsecure.storage.user.getNumber();
|
|
|
|
this.listenBack = options.listenBack;
|
2017-06-10 19:18:24 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
this.listenTo(this.model, 'change', this.render);
|
|
|
|
},
|
|
|
|
render_attributes: function() {
|
|
|
|
if (this.model.id === this.ourNumber) {
|
|
|
|
return {
|
|
|
|
title: i18n('me'),
|
|
|
|
number: this.model.getNumber(),
|
|
|
|
avatar: this.model.getAvatar(),
|
|
|
|
};
|
|
|
|
}
|
2017-06-10 19:18:24 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
return {
|
|
|
|
class: 'clickable',
|
|
|
|
title: this.model.getTitle(),
|
|
|
|
number: this.model.getNumber(),
|
|
|
|
avatar: this.model.getAvatar(),
|
|
|
|
profileName: this.model.getProfileName(),
|
|
|
|
isVerified: this.model.isVerified(),
|
|
|
|
verified: i18n('verified'),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
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
|
|
|
})();
|