diff --git a/app/assets/javascripts/discourse/components/d-modal-body.js.es6 b/app/assets/javascripts/discourse/components/d-modal-body.js.es6 index a2b373400ab..660456db7f5 100644 --- a/app/assets/javascripts/discourse/components/d-modal-body.js.es6 +++ b/app/assets/javascripts/discourse/components/d-modal-body.js.es6 @@ -1,10 +1,17 @@ export default Ember.Component.extend({ classNames: ['modal-body'], + fixed: false, didInsertElement() { this._super(); $('#modal-alert').hide(); - $('.d-modal.fixed-modal').modal('show'); + + let fixedParent = this.$().closest('.d-modal.fixed-modal'); + if (fixedParent.length) { + this.set('fixed', true); + fixedParent.modal('show'); + } + Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender); this.appEvents.on('modal-body:flash', msg => this._flash(msg)); }, @@ -28,7 +35,14 @@ export default Ember.Component.extend({ } } - this.appEvents.trigger('modal:body-shown', this.getProperties('title', 'rawTitle')); + this.appEvents.trigger( + 'modal:body-shown', + this.getProperties( + 'title', + 'rawTitle', + 'fixed' + ) + ); }, _flash(msg) { diff --git a/app/assets/javascripts/discourse/components/d-modal.js.es6 b/app/assets/javascripts/discourse/components/d-modal.js.es6 index e0cf5bafc13..c015ca6ba52 100644 --- a/app/assets/javascripts/discourse/components/d-modal.js.es6 +++ b/app/assets/javascripts/discourse/components/d-modal.js.es6 @@ -27,7 +27,11 @@ export default Ember.Component.extend({ }); this.appEvents.on('modal:body-shown', data => { - this.$().removeClass('hidden'); + if (this.isDestroying || this.isDestroyed) { return; } + if (data.fixed) { + this.$().removeClass('hidden'); + } + if (data.title) { this.set('title', I18n.t(data.title)); } else if (data.rawTitle) {