Render group members in the message detail view

This requires that we fetch contact info when opening a conversation
so that's available for rendering contact names and avatars.
This commit is contained in:
lilia 2015-02-24 16:02:33 -08:00
parent 2277b41639
commit c08c29bd4a
5 changed files with 37 additions and 10 deletions

View file

@ -34,6 +34,7 @@
initialize: function() {
this.messageCollection = new Whisper.MessageCollection();
this.contactCollection = new Whisper.ConversationCollection();
},
validate: function(attributes, options) {
@ -143,6 +144,20 @@
return this.messageCollection.fetchConversation(this.id, options);
},
fetchContacts: function(options) {
if (this.isPrivate()) {
this.contactCollection.reset([this]);
} else {
this.contactCollection.reset(
this.get('members').map(function(number) {
var c = this.collection.add({id: number, type: 'private'});
c.fetch();
return c;
}.bind(this))
);
}
},
archive: function() {
this.unset('active_at');
},
@ -165,6 +180,9 @@
} else {
return '';
}
},
isPrivate: function() {
return this.get('type') === 'private';
}
});

View file

@ -40,6 +40,9 @@
},
isGroupUpdate: function() {
return !!(this.get('group_update'));
},
isIncoming: function() {
return this.get('type') === 'incoming';
}
});