mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-16 20:43:01 +03:00
c6d9fdfe06
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.
22 lines
747 B
JavaScript
22 lines
747 B
JavaScript
var PostController = Ember.ObjectController.extend({
|
|
isPublished: Ember.computed.equal('status', 'published'),
|
|
classNameBindings: ['featured'],
|
|
|
|
actions: {
|
|
toggleFeatured: function () {
|
|
var featured = this.toggleProperty('featured'),
|
|
self = this;
|
|
|
|
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);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
export default PostController;
|