From ddd2e67eb5de1e105fb938115123643ad049f687 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 5 Nov 2015 20:11:28 -0800 Subject: [PATCH] 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 --- js/views/conversation_view.js | 2 +- js/views/message_detail_view.js | 3 ++- js/views/message_view.js | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 2d8e0445..7c6b59db 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -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' }, diff --git a/js/views/message_detail_view.js b/js/views/message_detail_view.js index 2eeea9bc..ee641d3a 100644 --- a/js/views/message_detail_view.js +++ b/js/views/message_detail_view.js @@ -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) { diff --git a/js/views/message_view.js b/js/views/message_view.js index 3c0ca0a8..a5b01219 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -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() {