You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
/* global Whisper: false */
 | 
						|
/* global textsecure: false */
 | 
						|
 | 
						|
// eslint-disable-next-line func-names
 | 
						|
(function() {
 | 
						|
  'use strict';
 | 
						|
 | 
						|
  window.Whisper = window.Whisper || {};
 | 
						|
 | 
						|
  Whisper.ContactListView = Whisper.ListView.extend({
 | 
						|
    tagName: 'div',
 | 
						|
    itemView: Whisper.View.extend({
 | 
						|
      tagName: 'div',
 | 
						|
      className: 'contact',
 | 
						|
      templateName: 'contact',
 | 
						|
      initialize(options) {
 | 
						|
        this.ourNumber = textsecure.storage.user.getNumber();
 | 
						|
        this.listenBack = options.listenBack;
 | 
						|
 | 
						|
        this.listenTo(this.model, 'change', this.render);
 | 
						|
      },
 | 
						|
      render() {
 | 
						|
        if (this.contactView) {
 | 
						|
          this.contactView.remove();
 | 
						|
          this.contactView = null;
 | 
						|
        }
 | 
						|
 | 
						|
        const isMe = this.ourNumber === this.model.id;
 | 
						|
 | 
						|
        this.contactView = new Whisper.ReactWrapperView({
 | 
						|
          className: 'contact-wrapper',
 | 
						|
          Component: window.Signal.Components.ContactListItem,
 | 
						|
          props: {
 | 
						|
            isMe,
 | 
						|
            avatarPath: this.model.getAvatarPath(),
 | 
						|
            phoneNumber: this.model.getNumber(),
 | 
						|
            name: this.model.getName(),
 | 
						|
            profileName: this.model.getProfileName(),
 | 
						|
            verified: this.model.isVerified(),
 | 
						|
            onClick: this.showIdentity.bind(this),
 | 
						|
          },
 | 
						|
        });
 | 
						|
        this.$el.append(this.contactView.el);
 | 
						|
        return this;
 | 
						|
      },
 | 
						|
      showIdentity() {
 | 
						|
        if (this.model.id === this.ourNumber) {
 | 
						|
          return;
 | 
						|
        }
 | 
						|
        const view = new Whisper.KeyVerificationPanelView({
 | 
						|
          model: this.model,
 | 
						|
        });
 | 
						|
        this.listenBack(view);
 | 
						|
      },
 | 
						|
    }),
 | 
						|
  });
 | 
						|
})();
 |