Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

561 create site kit permanent dismissal route #21988

Merged
merged 21 commits into from
Jan 29, 2025

Conversation

pls78
Copy link
Member

@pls78 pls78 commented Jan 22, 2025

Context

  • We want to add a REST route to permanently dismiss the Site Kit configuration.

Summary

This PR can be summarized in the following changelog entry:

  • Adds a REST route to permanently dismiss the Site Kit configuration in the Yoast SEO Dashboard.

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:

  • Make sure you are logged in as admin
  • By using an API client of choice (e.g. Postmar or cURL), perform the following POST request:
    https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_configuration_permanent_dismissal
    whereYOUR_WORDPRESS_SITE is the URL of your WordPress installation
  • Set the request body as follows:
    {
      "is_dismissed": true
    }
    
    • Verify you get a successful response
  • With a MySQL inspect the value of the wpseo option array in the wp_options table
    • Verify that site_kit_configuration_permanently_dismissed is set to 1
  • Log in as an author
  • Perform the same API call as before
    • Verify you get a 403 - rest_forbidden response

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

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • N/A

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.
  • 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

@coveralls
Copy link

coveralls commented Jan 22, 2025

Pull Request Test Coverage Report for Build e800d8e30b142d4252aea8d6f73acf0eb8daa783

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

  • 30 of 47 (63.83%) changed or added relevant lines in 3 files are covered.
  • 988 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.1%) to 54.473%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/dashboard/infrastructure/configuration/permanently-dismissed-site-kit-configuration-repository.php 3 7 42.86%
src/dashboard/user-interface/configuration/site-kit-configuration-dismissal-route.php 27 32 84.38%
src/dashboard/infrastructure/endpoints/site-kit-configuration-dismissal-endpoint.php 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
src/integrations/admin/integrations-page.php 15 87.7%
src/generated/container.php 973 0.38%
Totals Coverage Status
Change from base Build df0bc85d18ba1d1ee47d9e86c715107e398c9892: -0.1%
Covered Lines: 30132
Relevant Lines: 55715

💛 - Coveralls

@pls78 pls78 added changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog changelog: other Needs to be included in the 'Other' category in the changelog and removed changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog labels Jan 23, 2025
@pls78 pls78 marked this pull request as ready for review January 23, 2025 09:44
Copy link
Contributor

@thijsoo thijsoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the implementation is fine just 2 comments 🚧 about naming

*
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
*/
class Site_Kit_Widget_Permanent_Dismissal_Route implements Route_Interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we want to call the connection thing a widget in normal speech and in the code since it does not behave as a widget in the sense of widgets can be moved around

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just call it site_kit_configuration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

pls78 added 9 commits January 28, 2025 10:19
* Moved both the repository and the route under the `Configuration` subfolder namespace
* Implemented the endpoint related to the route
* Fixed the route to pass `is_dismissed` from the request body and not from the URL
@thijsoo thijsoo added this to the 24.4 milestone Jan 29, 2025
Copy link
Contributor

@thijsoo thijsoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR + ACC 👍

@thijsoo thijsoo merged commit fedc1b2 into trunk Jan 29, 2025
26 checks passed
@thijsoo thijsoo deleted the 561-create-site-kit-permanent-dismissal-route branch January 29, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: other Needs to be included in the 'Other' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants