mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Prevent stacking notifications during rapid toggle
No issue -Call notifications.closePassive after the resolution of the promise that generates the notifications. Otherwise multiple promises can stack up after notifications have been cleared, which results in a bunch of stacked notifications. -Remove some unnecessary propagation of rejected promises from action handlers that can result in unhandled reject errors.
This commit is contained in:
parent
c5771e73bb
commit
c6d9fdfe06
4 changed files with 5 additions and 8 deletions
|
@ -11,7 +11,6 @@ var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
|
|||
if (model.get('id')) {
|
||||
self.transitionToRoute('editor.edit', model);
|
||||
}
|
||||
return model;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,12 @@ var PostController = Ember.ObjectController.extend({
|
|||
var featured = this.toggleProperty('featured'),
|
||||
self = this;
|
||||
|
||||
self.notifications.closePassive();
|
||||
|
||||
this.get('model').save().then(function () {
|
||||
self.notifications.closePassive();
|
||||
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
|
||||
}).catch(function (errors) {
|
||||
self.notifications.closePassive();
|
||||
self.notifications.showErrors(errors);
|
||||
return Ember.RSVP.reject(errors);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,16 +30,14 @@ var SettingsGeneralController = Ember.ObjectController.extend({
|
|||
save: function () {
|
||||
var self = this;
|
||||
|
||||
self.notifications.closePassive();
|
||||
|
||||
return this.get('model').save().then(function (model) {
|
||||
self.notifications.closePassive();
|
||||
self.notifications.showSuccess('Settings successfully saved.');
|
||||
|
||||
return model;
|
||||
}).catch(function (errors) {
|
||||
self.notifications.closePassive();
|
||||
self.notifications.showErrors(errors);
|
||||
|
||||
return Ember.RSVP.reject(errors);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ var SigninController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerM
|
|||
this.validate({ format: false }).then(function () {
|
||||
self.send('authenticate');
|
||||
}).catch(function (errors) {
|
||||
self.notifications.closePassive();
|
||||
self.notifications.showErrors(errors);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue