Don't store conversationType on messages
This was used to conditionally render messages in the group style, but it's actually unnecessary. We can render the same markup in both cases and change the appearance with css.
This commit is contained in:
parent
27fa391112
commit
8c93101989
4 changed files with 17 additions and 9 deletions
|
@ -47,7 +47,6 @@
|
|||
body : message,
|
||||
timestamp : timestamp,
|
||||
conversationId : this.id,
|
||||
conversationType : this.get('type'),
|
||||
type : 'outgoing',
|
||||
attachments : attachments,
|
||||
}).save();
|
||||
|
@ -68,13 +67,12 @@
|
|||
var conversation = this;
|
||||
var timestamp = decrypted.pushMessage.timestamp.toNumber();
|
||||
var m = this.messageCollection.add({
|
||||
body: decrypted.message.body,
|
||||
timestamp: timestamp,
|
||||
conversationId: this.id,
|
||||
conversationType: this.get('type'),
|
||||
attachments: decrypted.message.attachments,
|
||||
type: 'incoming',
|
||||
sender: decrypted.pushMessage.source
|
||||
body : decrypted.message.body,
|
||||
timestamp : timestamp,
|
||||
conversationId : this.id,
|
||||
attachments : decrypted.message.attachments,
|
||||
type : 'incoming',
|
||||
sender : decrypted.pushMessage.source
|
||||
});
|
||||
|
||||
if (timestamp > this.get('timestamp')) {
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
this.$el.find('.discussion-container').append(this.view.el);
|
||||
|
||||
this.model.fetchMessages({reset: true});
|
||||
|
||||
if (this.model.get('type') === 'group') {
|
||||
this.$el.addClass('group');
|
||||
}
|
||||
},
|
||||
|
||||
events: {
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
message: this.model.get('body'),
|
||||
timestamp: moment(this.model.get('timestamp')).fromNow(),
|
||||
bubble_class: this.model.get('type') === 'outgoing' ? 'sent' : 'incoming',
|
||||
sender: this.model.get('conversationType') === 'group' ? this.model.get('sender') : ''
|
||||
sender: this.model.get('sender')
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -43,10 +43,16 @@ ul.discussion {
|
|||
}
|
||||
|
||||
li.entry .sender {
|
||||
display: none;
|
||||
font-size: 0.75em;
|
||||
opacity: 0.54;
|
||||
}
|
||||
|
||||
.group.conversation li.entry .sender {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
li.entry .avatar {
|
||||
height:32px;
|
||||
width:32px;
|
||||
|
|
Loading…
Add table
Reference in a new issue