mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
beba43b8f3
closes #3667 - If the ‘save’ function on a new post fails, the local Ember model still beliefs that the status is ‘published’, resulting in wrong buttons. A simple catch fixes that.
23 lines
667 B
JavaScript
23 lines
667 B
JavaScript
import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
|
|
|
|
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
|
|
actions: {
|
|
/**
|
|
* Redirect to editor after the first save
|
|
*/
|
|
save: function () {
|
|
var self = this;
|
|
this._super().then(function (model) {
|
|
if (model.get('id')) {
|
|
self.transitionToRoute('editor.edit', model);
|
|
}
|
|
}).catch(function () {
|
|
// Publishing failed
|
|
self.set('status', 'draft');
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
export default EditorNewController;
|