Skip to content

Preview: Enable published posts preview#7189

Merged
aduth merged 13 commits intofix/autosave-previewfrom
add/publish-preview
Jun 11, 2018
Merged

Preview: Enable published posts preview#7189
aduth merged 13 commits intofix/autosave-previewfrom
add/publish-preview

Conversation

@aduth
Copy link
Copy Markdown
Member

@aduth aduth commented Jun 6, 2018

Closes (when #7130 is merged): #7179
Closes (when #7130 is merged): #2544
Related: #6257, #6882

Note: Merges to fix/autosave-preview (#7130) as base branch.
Note: As best I can tell, this branch is fully functional, but I have plans to include new end-to-end tests for various preview circumstances prior to merge.

This pull request seeks to allow the user to preview changes to a published post without first updating the post (i.e. the autosave revision preview).

In doing so, it...

To the latter point, I landed at the conclusion that preview_link only makes sense in the context of autsosaves on consideration of:

  • The post endpoints reflect the value of the canonical saved post. If there are no unsaved changes, the user should be directed to post.link as its preview.
  • It does not belong in the revisions endpoints because it is not the case that any revision can be previewed. A preview only occurs for the latest revision of a post (_set_preview, wp_get_post_autosave).

Related Trac tickets:

Thus, if there are no unsaved changes for a post, the Preview button is effectively a link to post.link. If there are unsaved changes, the autosave is triggered and once its responses' autosave.preview_link becomes accessible, it is used in the redirect (regardless of whether or not the autosave occurred as a full save as described in #7124).

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants