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
This commit is contained in:
Benedikt Constantin Radtke 2016-07-01 22:20:39 +02:00 committed by lilia
parent c1b8ff9e54
commit 2870c1fff2

View file

@ -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));