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.
pull/749/head
lilia 10 years ago
parent 27fa391112
commit 8c93101989

@ -47,7 +47,6 @@
body : message, body : message,
timestamp : timestamp, timestamp : timestamp,
conversationId : this.id, conversationId : this.id,
conversationType : this.get('type'),
type : 'outgoing', type : 'outgoing',
attachments : attachments, attachments : attachments,
}).save(); }).save();
@ -68,13 +67,12 @@
var conversation = this; var conversation = this;
var timestamp = decrypted.pushMessage.timestamp.toNumber(); var timestamp = decrypted.pushMessage.timestamp.toNumber();
var m = this.messageCollection.add({ var m = this.messageCollection.add({
body: decrypted.message.body, body : decrypted.message.body,
timestamp: timestamp, timestamp : timestamp,
conversationId: this.id, conversationId : this.id,
conversationType: this.get('type'), attachments : decrypted.message.attachments,
attachments: decrypted.message.attachments, type : 'incoming',
type: 'incoming', sender : decrypted.pushMessage.source
sender: decrypted.pushMessage.source
}); });
if (timestamp > this.get('timestamp')) { if (timestamp > this.get('timestamp')) {

@ -35,6 +35,10 @@
this.$el.find('.discussion-container').append(this.view.el); this.$el.find('.discussion-container').append(this.view.el);
this.model.fetchMessages({reset: true}); this.model.fetchMessages({reset: true});
if (this.model.get('type') === 'group') {
this.$el.addClass('group');
}
}, },
events: { events: {

@ -61,7 +61,7 @@
message: this.model.get('body'), message: this.model.get('body'),
timestamp: moment(this.model.get('timestamp')).fromNow(), timestamp: moment(this.model.get('timestamp')).fromNow(),
bubble_class: this.model.get('type') === 'outgoing' ? 'sent' : 'incoming', 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 { li.entry .sender {
display: none;
font-size: 0.75em; font-size: 0.75em;
opacity: 0.54; opacity: 0.54;
} }
.group.conversation li.entry .sender {
display: block;
}
li.entry .avatar { li.entry .avatar {
height:32px; height:32px;
width:32px; width:32px;

Loading…
Cancel
Save