Expose preview_link through the REST API and use within client#6882
Merged
danielbachhuber merged 3 commits intomasterfrom May 22, 2018
Merged
Expose preview_link through the REST API and use within client#6882danielbachhuber merged 3 commits intomasterfrom
preview_link through the REST API and use within client#6882danielbachhuber merged 3 commits intomasterfrom
Conversation
pento
approved these changes
May 22, 2018
Member
pento
left a comment
There was a problem hiding this comment.
A couple of minor tweaks, but 👍🏻once they're done.
| @@ -354,12 +353,11 @@ export function getEditedPostExcerpt( state ) { | |||
| * @return {string} Preview URL. | |||
| */ | |||
| export function getEditedPostPreviewLink( state ) { | |||
Member
There was a problem hiding this comment.
This could be simplified further, see getCurrentPostId() for an example.
editor/store/test/selectors.js
Outdated
| @@ -1068,11 +1068,11 @@ describe( 'selectors', () => { | |||
| it( 'should return the correct url adding a preview parameter to the query string', () => { | |||
Member
There was a problem hiding this comment.
Description should be updated to match the new behaviour.
gziolo
reviewed
May 22, 2018
| } | ||
|
|
||
| return addQueryArgs( link, { preview: 'true' } ); | ||
| return getCurrentPost( state ).preview_link || null; |
Member
There was a problem hiding this comment.
I think it would be better to use getEditedPostAttribute( 'preview_link' ) so we could get rid of getCurrentPost at some point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Exposes a
preview_linkvalue for Posts through the REST API, and then references this value when generating the "Preview" button.Fixes #4555
Related https://core.trac.wordpress.org/ticket/44180
How has this been tested?
Manually verified the correct link is displayed when a post is in draft vs. publish:
Checklist: