Fix incoming key conflict behaviors
Follow up to ddd2e67eb5
but for incoming messages.
* Conflict state sometimes failed to be removed even though the
conflict was resolved.
* Messages failed to re-render after a conflict. We want to
re-render only the error state on outgoing messages, to avoid
flickering attachments. On incoming messages, we need to call
render to populate the message text, avatar, etc...
// FREEBIE
This commit is contained in:
parent
c34f8e330d
commit
4136e3633c
2 changed files with 9 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
|||
tagName: "li",
|
||||
template: $('#message').html(),
|
||||
initialize: function() {
|
||||
this.listenTo(this.model, 'change:errors', this.renderErrors);
|
||||
this.listenTo(this.model, 'change:errors', this.onErrorsChanged);
|
||||
this.listenTo(this.model, 'change:body', this.render);
|
||||
this.listenTo(this.model, 'change:delivered', this.renderDelivered);
|
||||
this.listenTo(this.model, 'change', this.renderSent);
|
||||
|
@ -44,6 +44,13 @@
|
|||
renderDelivered: function() {
|
||||
if (this.model.get('delivered')) { this.$el.addClass('delivered'); }
|
||||
},
|
||||
onErrorsChanged: function() {
|
||||
if (this.model.isIncoming()) {
|
||||
this.render();
|
||||
} else {
|
||||
this.renderErrors();
|
||||
}
|
||||
},
|
||||
renderErrors: function() {
|
||||
var errors = this.model.get('errors');
|
||||
if (_.size(errors) > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue