Skip to content

Tweak targetSchema Response#6613

Merged
danielbachhuber merged 1 commit into6361-post-stickyfrom
try/6529-tweak-targetschema-response
May 7, 2018
Merged

Tweak targetSchema Response#6613
danielbachhuber merged 1 commit into6361-post-stickyfrom
try/6529-tweak-targetschema-response

Conversation

@pento
Copy link
Copy Markdown
Member

@pento pento commented May 7, 2018

Description

This is a PR against #6529.

It tweaks the response for the wp:action-sticky link, to more clearly state what it's used for:

  • Move the description outside of the targetSchema object, to wp:action-sticky's title attribute. This makes it clear that the text is referring to the link, not the targetSchema.
  • Reword the text to more accurately reflect the nature of the wp:action-sticky link: if wp:action-sticky is present, then the current user has the ability to make the post sticky.

@danielbachhuber danielbachhuber merged commit 3a9ccc1 into 6361-post-sticky May 7, 2018
@danielbachhuber danielbachhuber deleted the try/6529-tweak-targetschema-response branch May 7, 2018 12:18
danielbachhuber added a commit that referenced this pull request May 7, 2018
…6529)

* Use `targetSchema` of JSON Hyper Schema to communicate sticky action

Because WordPress' capabilities system is filterable, we need to execute
the capabilities before we know whether the current user can perform the
action. Fortunately, `targetSchema` supports exactly this use-case.

* Ensure links are properly formatted

* Avoid re-renders when the current post changes

* Technically more correct test

* Update tests for 3e591c5

* Only include `wp:action-sticky` for `context=edit`; move description

* Move the description text from the targetSchema to the link title. (#6613)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

REST API Interaction Related to REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants