0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Revert post status on failed save.

Refs #3667, Refs #3776
- If saving a post fails, revert its status back to the
  pre-save value.
- Added tests to check post status after failed save attempt
  on both new and existing posts.
This commit is contained in:
Jason Williams 2014-08-14 20:39:02 +00:00
parent 153a0c818f
commit 09ede03ce4
2 changed files with 3 additions and 3 deletions

View file

@ -11,9 +11,6 @@ var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
if (model.get('id')) {
self.transitionToRoute('editor.edit', model);
}
}).catch(function () {
// Publishing failed
self.set('status', 'draft');
});
}
}

View file

@ -211,6 +211,9 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
return model;
}).catch(function (errors) {
self.showErrorNotification(prevStatus, self.get('status'), errors);
self.set('status', prevStatus);
return Ember.RSVP.reject(errors);
});
},