-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get single post from API by id and query params; Auto-sort posts list #2884
Conversation
@@ -77,6 +77,8 @@ posts = { | |||
// only published posts if no user is present | |||
if (!(options.context && options.context.user)) { | |||
data.status = 'published'; | |||
} else { | |||
data.status = data.status || 'all'; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
The API, by default, should only ever return published posts, this is fundamental logic for a blog and shouldn't be changed. That's why the tests are there. This is also why we need @rjackson's fix from #2857 and why any of this is complicated at all. It is the job of the admin to make sure it asks for draft posts as well as published ones, as in the admin we are an authenticated user who has permission to view the drafts. |
@ErisDS Ahh, I thought the user check might ensure that the user owned the posts, so sending a draft would be safe. Either way, the Ember-Data calls can be fixed up to query the main |
Yeah I think this is otherwise 👍 |
What's holding this back at present? |
@ErisDS The Editor PR. :P I also want to ask a few questions to see how to proceed. |
Can we get this in now? It needs a fix and a rebase etc but I think it's pretty much otherwise good to go? |
Whatever you prefer, I'm happy to get this in asap if you want? |
closes TryGhost#2883, closes TryGhost#2951 - introduce custom findQuery in ApplicationAdapter - posts/post route and editor/edit route now use custom findQuery to find a single post by id with query params - create a sorting function in PostsController for out-of-order loading - refresh updated posts in posts.index to make PostsList highlight latest draft after returning from a save in editor
@ErisDS This is ready. |
Get single post from API by id and query params; Auto-sort posts list
Get single post from API by id and query params; Auto-sort posts list
closes #2883, closes #2951
The only problem I had was after updating a draft.. going back to the PostsRoute highlighted the previously last-updated draft, not the most currently updated one. I had to modify PostsIndexRoute to grab a fresh list from the server, but that causes an extra request on first landing on
/ghost/ember/
.