Don't add edit links in API response if user can't edit posts #22016
+2
−2
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.
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
"links": []
transform_dashboard_url_for_testing()
function of the helper doc, make it return early with a post URL, withreturn 'http://example.com/post-permalink';
. That way, we simulate site kit returning that URL as a top 5 page (it will actually return all 5 pages as that URL).transform_dashboard_url_for_testing()
function, make it return early with the URL of that post."links": { "edit": "http://example.com/wp-admin/post.php?post=5&action=edit" }
and confirm that it points you to the edit page of that post you just created and that you can actually edit that posttransform_dashboard_url_for_testing()
function, make it return early with the URL of a term"links": { "edit": "http://example.com/wp-admin/term.php?taxonomy=category&tag_ID=3&post_type=post" }
and confirm that it points you to the edit page of that term and that you can actually edit that term.// $role->remove_cap('edit_terms');
and// $role->remove_cap('manage_categories');
lines in your filter above and deactivate/reactivate Yoast SEO. That way you remove the capability of editing terms for SEO managersremove_edit_others_posts_capability
filter you have added above and confirm that you get an edit button in all cases where that's possible (that is, for posts and terms). Also confirm that you can actually go to that edit pages.Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes https://github.com/Yoast/reserved-tasks/issues/436