Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Refactor #59

Merged
merged 108 commits into from Jul 27, 2016
Merged

Refactor #59

merged 108 commits into from Jul 27, 2016

Conversation

westonruter
Copy link
Contributor

@westonruter westonruter commented Jul 11, 2016

Over the past week, off-and-on, I've done a deep dive into the snapshots PHP code and I believe I've come up with an improved refactored codebase that cleans out some cruft and improves maintainability.

  • Refactor codebase, including new Post_Type class
  • Use customize_refresh_nonces filter to export snapshot nonce
  • Eliminate generate_snapshot_uuid request by returning new UUID in saving response
  • Ensure that setting validations are handled in snapshot requests
  • Fixes Clear up distinction between previewing vs saving values in a snapshot #26 by removing the can_preview method: only users who have the setting's capability can write to the snapshot, so everyone should be able to freely preview what has been stored there.
  • Fixes Fail updating a snapshot if any of the setting values are invalid #31 by adding support for setting validation.
  • Fixes Save & Activate button is missing #28 by ensuring that snapshots UI isn't loaded if a theme switch is happening.
  • Important change: Since scope was removed, now we don't need a dirty flag in the post data. We're only storing the changed values. Because of this, we can now simplify the snapshot data to just be the values. We can skip storing a sanitized flag as well, however this needs more discovery.
  • Allow snapshot posts to be published from the admin, and thus also scheduled for publication. Customizer settings get saved when a snapshot post transitions to the publish status. If any of the settings are unrecognized or invalid, none of the settings are saved and the status gets kicked back to pending with error messages explaining the problem(s). Published snapshots are considered "locked" and the UI for updating them is hidden, aside from trash. Fixes Allow snapshot posts to publish and be scheduled #62.
  • Add link in Customizer to access edit post screen.
  • Ensure that get_permalink() returns the frontend URL for the site with the customize_snapshot_uuid param added.
  • Add initial read-only REST API endpoints for snapshots. See Add initial read-only REST API endpoints for snapshots #63.

Todos:

  • Update unit tests to work with newly-refactored codebase.
  • Make sure that widget instance data is properly encoded so that it can be re-hydrated.
  • Make sure that saving a snapshot with invalid settings will cause the invalidation messages to appear in the settings as opposed to a modal error screen.

PR originally opened to master in #53

…nt; ensure data migration accounts for dirty
Check for unauthorized, unrecognized, and invalid settings prior to sanitizing
@westonruter westonruter mentioned this pull request Jul 11, 2016
2 tasks
westonruter and others added 21 commits July 26, 2016 01:04
* Remove bulk actions filter
* Replace publish filter with transition filter.
* Remove hiding of publish metabox if not current theme. Allow publishing if not current theme.
* Remove hiding of author metabox.
* Remove extraneous info now that publish metabox is restored.
* Move Post_Type logic to Customize_Snapshot_Manager
Add initial read-only REST API endpoints for snapshots
Allow snapshot posts to publish and be scheduled
@coveralls
Copy link

coveralls commented Jul 27, 2016

Coverage Status

Coverage decreased (-4.7%) to 87.413% when pulling db598cb on feature/refactor into 04c80c0 on develop.

@coveralls
Copy link

coveralls commented Jul 27, 2016

Coverage Status

Coverage decreased (-4.7%) to 87.413% when pulling 9c56143 on feature/refactor into 04c80c0 on develop.

@westonruter westonruter merged commit 68e8f34 into develop Jul 27, 2016
@westonruter westonruter deleted the feature/refactor branch July 27, 2016 19:20
@westonruter westonruter modified the milestone: 0.5.0 Aug 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants