Fix re-rendering when resolving conflicts with media

* Don't open message detail views from message detail views
* When message errors change, re-render the error state, but
  not the message markup and contents.
* Fix renderErrors bug not removing the error class correctly.

// FREEBIE
This commit is contained in:
lilia 2015-11-05 20:11:28 -08:00
parent 9c8933c3d0
commit ddd2e67eb5
3 changed files with 6 additions and 4 deletions

View file

@ -80,7 +80,7 @@
'click .drop-down': 'toggleMenu',
'click .openInbox' : 'openInbox',
'click' : 'onClick',
'select .entry': 'messageDetail',
'select .message-list .entry': 'messageDetail',
'force-resize': 'forceUpdateMessageFieldSize',
'click .choose-file': 'focusMessageField'
},

View file

@ -36,6 +36,7 @@
template: $('#message-detail').html(),
initialize: function(options) {
this.view = new Whisper.MessageView({model: this.model});
this.view.render();
this.conversation = options.conversation;
this.listenTo(this.model, 'change', this.render);
@ -113,7 +114,7 @@
errors : this.errors['undefined'],
hasRetry : hasRetry
}));
this.view.render().$el.prependTo(this.$('.message-container'));
this.view.$el.prependTo(this.$('.message-container'));
if (this.model.isOutgoing()) {
this.conversation.contactCollection.reject(function(c) {

View file

@ -9,7 +9,8 @@
tagName: "li",
template: $('#message').html(),
initialize: function() {
this.listenTo(this.model, 'change:body change:errors', this.render);
this.listenTo(this.model, 'change:errors', this.renderErrors);
this.listenTo(this.model, 'change:body', this.render);
this.listenTo(this.model, 'change:delivered', this.renderDelivered);
this.listenTo(this.model, 'change', this.renderSent);
this.listenTo(this.model, 'change:flags change:group_update', this.renderControl);
@ -50,7 +51,7 @@
this.$('.content').text(this.model.getDescription()).addClass('error-message');
}
} else {
this.$el.removeClass('error');
this.$('.bubble').removeClass('error');
}
},
renderControl: function() {