From eb1a4b3ac6518ecfb258a0fe36d7cff423447cb2 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 1 Jun 2017 15:22:39 -0700 Subject: [PATCH] loadAttachments: Handle the zero -> some attachments case FREEBIE --- js/views/message_view.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/views/message_view.js b/js/views/message_view.js index c99b418c5..d01cfe0e0 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -261,10 +261,13 @@ this.$('.avatar').replaceWith(avatarView.render().$('.avatar')); }, loadAttachments: function() { - if (this.loadedAttachments) { + this.loadedAttachments = this.loadedAttachments || []; + + // Messages can go from no attachments to some attachments (via key approval), + // but they can't go from some attachments to a different set of them. + if (this.loadedAttachments.length) { return; } - this.loadedAttachments = []; this.model.get('attachments').forEach(function(attachment) { var view = new Whisper.AttachmentView({