-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Gutenberg: use v1.2 endpoint to create auto-draft #27673
Conversation
That's a great PR description, thank you so much for your effort! Generated by 🚫 dangerJS |
client/state/data-getters/index.js
Outdated
export const requestSitePost = ( siteId, postId, postType ) => { | ||
//post and page types are plural except for custom post types | ||
//eg /sites/<siteId>/posts/1234 vs /sites/<siteId>/jetpack-testimonial/4 | ||
const s = postType === 'page' || postType === 'post' ? 's' : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a clever one, but I'm personally not a big fan of adding the plural s
this way, and I'd rather have a more straightforward if/else-if/else, with the additional advantage of being self-explanatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No matter how we pluralize posts and pages, this works as expected.
@gwwar feel free to change the pluralization logic if you think it makes sense, but it's no blocker for
daca31f
to
f2383b3
Compare
I made the path logic less clever in f2383b3! Thanks for the review @Copons ✨ |
Fixes #27430 by updating our API call to use our v1.1 endpoint to create an auto-draft The Core
wp/v2
endpoint does not allow creation ofauto-drafts
. Our previous custom endpoint did not allow us to fetch all post types from Jetpack sites.Note that autosaves for custom post types don't appear to work
cc @mdawaffe I've added #27674
Testing Instructions
http://calypso.localhost:3000/gutenberg/post/<site>
http://calypso.localhost:3000/gutenberg/page/<site>
http://calypso.localhost:3000/gutenberg/edit/<cpt>/<site>