wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Don't overwrite user settings when the respective features are disabled

Open leonidasmi opened this issue 1 year ago • 1 comments

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 archives global setting
  • The Do not allow search engines to show this author's archives in search results checkbox - dependent on the Enable author archives global feature setting
  • The Disable SEO analysis checkbox - dependent on the SEO analysis global feature setting is enabled
  • The Disable readability analysis checkbox - dependent on the Readability analysis global feature setting
  • The Disable inclusive language analysis checkbox - dependent on the Inclusive language analysis global feature setting

According to the above, for every setting the test is

  1. Go to a user's profile, while the Yoast SEO global feature settings are enabled.
  2. Fill the Title to use for Author page with something (or any of the other user settings, mentioned above)
  3. Go to Yoast SEO->Settings->Author archives and disable the Enable author archives (or any of the other respective global feature settings, mentioned above)
  4. Refresh the user's profile and save it again (for a totally unrelated thing, like for example enabling the Show Toolbar when viewing site setting )
  5. Go to Yoast SEO->Settings->Author archives and re-enable the Enable author archives setting
  6. 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 title field to be the one we have in the user profile, no matter if the respective global setting is enabled or not.
  • 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 description field to be the one we have in the user profile, no matter if the respective global setting is enabled or not.
  • 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_noindex field to be the one we have in the user profile, no matter if the respective global setting is enabled or not.
  • 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 analysis checkbox has been checked or not. Try while toggling the global SEO analysis feature as well.
  • 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 analysis checkbox has been checked or not. Try while toggling the global inclusive language feature as well.
  • 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 analysis checkbox has been checked or not. Try while toggling the global readability analysis feature as well.

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 the Shopify label 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 innovation label.
  • [ ] I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/wordpress-seo/issues/21313

leonidasmi avatar Apr 12 '24 12:04 leonidasmi

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.

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 Coverage Status
Change from base Build 7808cc672d78a3be81bbc44b53018dd9d686405f: 0.2%
Covered Lines: 16378
Relevant Lines: 31971

💛 - Coveralls

coveralls avatar Apr 12 '24 12:04 coveralls