Fixed fastforwarding closing videos' fullscreen mode

This commit stops the MessageView from adding the attachment more than once. Previously an attachment was appended to the MessageView every time an update
event was emitted, which happens when forwarding.

// FREEBIE
pull/749/head
Benedikt Constantin Radtke 9 years ago committed by lilia
parent c1b8ff9e54
commit 2870c1fff2

@ -153,9 +153,11 @@
this.model.get('attachments').forEach(function(attachment) {
var view = new Whisper.AttachmentView({ model: attachment });
this.listenTo(view, 'update', function() {
this.trigger('beforeChangeHeight');
this.$('.attachments').append(view.el);
this.trigger('afterChangeHeight');
if(!view.el.parentNode) {
this.trigger('beforeChangeHeight');
this.$('.attachments').append(view.el);
this.trigger('afterChangeHeight');
}
});
view.render();
}.bind(this));

Loading…
Cancel
Save