Skip to content

Commit

Permalink
loadAttachments: Handle the zero -> some attachments case
Browse files Browse the repository at this point in the history
FREEBIE
  • Loading branch information
scottnonnenberg committed Jun 1, 2017
1 parent 0e1b534 commit eb1a4b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/views/message_view.js
Expand Up @@ -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({
Expand Down

0 comments on commit eb1a4b3

Please sign in to comment.