10up / simple-page-ordering

Order your pages and other hierarchical post types with simple drag and drop right from the standard page list.
https://wordpress.org/plugins/simple-page-ordering/
GNU General Public License v2.0
143 stars 22 forks source link

Fix a few minor code issues #149

Closed dkotter closed 1 year ago

dkotter commented 1 year ago

Description of the Change

While reviewing #148 I noticed there was some code that was no longer being used. I tracked that down to #129, where we refactored a few things but left some code in place that wasn't actually being used.

While putting together this PR to remove that code, I also noticed we had missing escaping in one place and that a couple of our text strings we show could be translated slightly better, so all of those have been fixed here.

So the things this PR does:

  1. Removes the code that references the screen_id, as the underlying code was removed in #129 but some code was left in place
  2. Update the reset confirmation message to use the post type on the PHP side (instead of replacing that on the JS side) and add a translator comment for that
  3. Add the post type to our reset message so it isn't hardcoded to always say post
  4. Add escaping around the post type value

How to test the Change

  1. Ensure you have a post type that is sortable (like the default page post type)
  2. Add multiple items within this post type
  3. Ensure you can sort these items by drag-and-drop
  4. Go to the Help tab and click on the Simple Page Ordering tab
  5. Ensure the reset message shows with the correct post type name
  6. Ensure clicking on this link shows a confirmation dialog with a message that reflects the proper post type
  7. Confirm this dialog and ensure post type sorting has been reset

Changelog Entry

Changed - Slightly change how some of our text is translated, passing in the post type Fixed - Remove code that was no longer needed Fixed - Add missing escaping

Credits

Props @dkotter

Checklist: