Simple Payments: Stop contributors from creating inaccessible buttons with a "pending" post status.#10116
Simple Payments: Stop contributors from creating inaccessible buttons with a "pending" post status.#10116
Conversation
|
Caution: This PR has changes that must be merged to WordPress.com |
This is automated check which relies on Generated by 🚫 dangerJS |
Hm, I'm not sure why you can't – well, you should be able to create the junk "pending" post, and then the UI will still show a failure notice to insert the shortcode into the post: I haven't seen the |
|
Caution: This PR has changes that must be merged to WordPress.com |
|
Was the site private? I think there's a second issue around permissions in that case. |
jeherve
left a comment
There was a problem hiding this comment.
Works well for me too now. The sandbox I was testing on had code stopping the Simple Payments module to load. 🤦♂️
Merging now!
* Readme: add boilerplate for next release, 6.6 * Add 6.5 to the changelog.txt file * Set boilerplate testing list for 6.6 * Readme: update stable tag to 6.5 * Add bullets to 6.5 changelog items * Readme: add link to previous changelogs This will help folks who want to know more about past releases, while keeping the readme.txt short so as to not overwhelm translators and site owners only looking for information about the last release. * Changelog: add information at the top of the changelog file. * Changelog: add #10054 * Changelog: add #10078 * Changelog: add #10079 * Changelog: add #10064 * Changelog: add #10094 * Changelog: add #10096 * Testing list: add more information based on #10087 * Changelog: add #9847 * Changelog: add #10084 * Changelog: add #9918 * Changelog: add #7614 * Changelog: add #10116 * Changelog: add #10108 * Changelog: add #10041 * Changelog: add #10121 * Changelog: add #10134 * Changelog: add #10130 * Changelog: add #10109 * changelog: add #10137 * changelog: add #9952 * changelog: add #10120 * changelog: add #10162 * Changelog: add #10163 * Changelog: add #10092 * changelog: add #10156 * Changelog: add #10154 * changelog: add #10122 * Changelog: add #10101 * changelog: add #10105 * changelog: add #10190 * Changelog: add #10196 * changelog: add #10152 * Changelog: add #10153 * Testing list: add more details to Site Verification testing steps. @see #10143 (comment) * changelog: add #10194 * Changelog: add #10193


When Contributors attempt to add a Simple Payments button, the API call (to
/sites/:site/posts/new) will succeed, creating a new button post entry in the site's database. However, this post (of typejp_pay_product) will have apendingstatus, due to custom post type handling in the API. The button insert will fail in the Calypso UI, and site admins won't be able to interact with these zombie buttons since we explicitly list only published buttons in the UI.Rather than have buttons of multiple possible statuses in the database, and rather than interfering with the current handling of all CPTs in the API, this PR bumps the
edit_postscapability forjp_pay_producttopublish_posts, making only Authors and above capable of creating Simple Payment buttons; Contributors will now get a failed permissions response, and no button post will be added to the site database.Testing
error: "unauthorized"