mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #2892 from appleYaks/draft-404
Fix Editor/:postId 404 on draft
This commit is contained in:
commit
d9f7aa2ce1
1 changed files with 11 additions and 1 deletions
|
@ -5,7 +5,17 @@ var EditorRoute = AuthenticatedRoute.extend(styleBody, {
|
|||
classNames: ['editor'],
|
||||
controllerName: 'posts.post',
|
||||
model: function (params) {
|
||||
return this.store.find('post', params.post_id);
|
||||
var post = this.store.getById('post', params.post_id);
|
||||
|
||||
if (post) {
|
||||
return post;
|
||||
}
|
||||
|
||||
return this.store.filter('post', { status: 'all' }, function (post) {
|
||||
return post.get('id') === params.post_id;
|
||||
}).then(function (records) {
|
||||
return records.get('firstObject');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue