wordpress-seo
wordpress-seo copied to clipboard
Don't overwrite user settings when the respective features are disabled
Context
Summary
This PR can be summarized in the following changelog entry:
- Fixes a bug where the yoast user settings would be wiped out after a user profile update, when the respective global settings were disabled.
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
The user settings that we're interested in, along with their relations with global settings, are:
- The Title to use for Author page and the Meta description to use for Author page fields - dependent on the
Enable author archivesglobal setting - The Do not allow search engines to show this author's archives in search results checkbox - dependent on the
Enable author archivesglobal feature setting - The Disable SEO analysis checkbox - dependent on the
SEO analysisglobal feature setting is enabled - The Disable readability analysis checkbox - dependent on the
Readability analysisglobal feature setting - The Disable inclusive language analysis checkbox - dependent on the
Inclusive language analysisglobal feature setting
According to the above, for every setting the test is
- Go to a user's profile, while the Yoast SEO global feature settings are enabled.
- Fill the Title to use for Author page with something (or any of the other user settings, mentioned above)
- Go to Yoast SEO->Settings->Author archives and disable the
Enable author archives(or any of the other respective global feature settings, mentioned above) - Refresh the user's profile and save it again (for a totally unrelated thing, like for example enabling the
Show Toolbar when viewing sitesetting ) - Go to Yoast SEO->Settings->Author archives and re-enable the
Enable author archivessetting - Refresh the user's profile
With this PR/RC:
- the Title to use for Author page setting has its original value persisted
Before this PR/RC:
- the Title to use for Author page setting has no value
Relevant test scenarios
- [ ] Changes should be tested with the browser console open
- [ ] Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
- [ ] Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
- [ ] Changes should be tested on different browsers
- [ ] Changes should be tested on multisite
Test instructions for QA when the code is in the RC
- [x] QA should use the same steps as above.
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
- For wpseo_title (
Title to use for Author page):- Confirm that every time we save a user profile, in the indexable for that user, we expect the value in the
titlefield to be the one we have in the user profile, no matter if the respective global setting is enabled or not.
- Confirm that every time we save a user profile, in the indexable for that user, we expect the value in the
- For wpseo_metadesc (
Meta description to use for Author page):- Confirm that every time we save a user profile, in the indexable for that user, we expect the value in the
descriptionfield to be the one we have in the user profile, no matter if the respective global setting is enabled or not.
- Confirm that every time we save a user profile, in the indexable for that user, we expect the value in the
- For wpseo_noindex_author (
Do not allow search engines to show this author's archives in search results):- Confirm that every time we save a user profile, in the indexable for that user, we expect the value in the
is_robots_noindexfield to be the one we have in the user profile, no matter if the respective global setting is enabled or not.
- Confirm that every time we save a user profile, in the indexable for that user, we expect the value in the
- For wpseo_content_analysis_disable (
Disable SEO analysis):- The readability tab in the post editor is shown or not, according to whether the
Disable SEO analysischeckbox has been checked or not. Try while toggling the global SEO analysis feature as well.
- The readability tab in the post editor is shown or not, according to whether the
- For wpseo_inclusive_language_analysis_disable (
Disable inclusive language analysis):- The inclusive language tab in the post editor is shown or not, according to whether the
Disable inclusive language analysischeckbox has been checked or not. Try while toggling the global inclusive language feature as well.
- The inclusive language tab in the post editor is shown or not, according to whether the
- For wpseo_keyword_analysis_disable (
Disable readability analysis):- The readability tab in the post editor is shown or not, according to whether the
Disable readability analysischeckbox has been checked or not. Try while toggling the global readability analysis feature as well.
- The readability tab in the post editor is shown or not, according to whether the
UI changes
- [ ] This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.
Other environments
- [ ] This PR also affects Shopify. I have added a changelog entry starting with
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.
Documentation
- [ ] I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.
Quality assurance
- [ ] I have tested this code to the best of my abilities.
- [ ] During testing, I had activated all plugins that Yoast SEO provides integrations for.
- [x] I have added unit tests to verify the code works as intended.
- [ ] If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
- [ ] I have written this PR in accordance with my team's definition of done.
- [ ] I have checked that the base branch is correctly set.
Innovation
- [ ] No innovation project is applicable for this PR.
- [ ] This PR falls under an innovation project. I have attached the
innovationlabel. - [ ] I have added my hours to the WBSO document.
Fixes https://github.com/Yoast/wordpress-seo/issues/21313
Pull Request Test Coverage Report for Build 8b43089c625103ac862fa11105ec20207cf5705a
Warning: This coverage report may be inaccurate.
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
- For more information on this, see Tracking coverage changes with pull request builds.
- To avoid this issue with future PRs, see these Recommended CI Configurations.
- For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
Details
- 152 of 164 (92.68%) changed or added relevant lines in 10 files are covered.
- 197 unchanged lines in 6 files lost coverage.
- Overall coverage increased (+0.2%) to 51.228%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| admin/class-admin-user-profile.php | 0 | 1 | 0.0% |
| admin/views/user-profile.php | 0 | 1 | 0.0% |
| src/user-meta/user-interface/custom-meta-integration.php | 5 | 15 | 33.33% |
| <!-- | Total: | 152 | 164 |
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| admin/class-admin-user-profile.php | 1 | 0.0% |
| src/conditionals/primary-category-conditional.php | 6 | 0.0% |
| src/helpers/first-time-configuration-notice-helper.php | 8 | 82.35% |
| src/generated/container.php | 16 | 0.16% |
| wp-seo-main.php | 18 | 0.0% |
| src/integrations/settings-integration.php | 148 | 28.34% |
| <!-- | Total: | 197 |
| Totals | |
|---|---|
| Change from base Build 7808cc672d78a3be81bbc44b53018dd9d686405f: | 0.2% |
| Covered Lines: | 16378 |
| Relevant Lines: | 31971 |