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

Declare required arguments for the site kit configuration endpoints #22018

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

leonidasmi
Copy link
Contributor

@leonidasmi leonidasmi commented Feb 5, 2025

Context

  • We want to make sure we don't throw 500 error codes when the endpoint is misused

Summary

This PR can be summarized in the following changelog entry:

  • Improves the configuration endpoints by declaring their arguments as required.

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:

  • Do a POST request to https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_manage_consent with no body

Without this PR:

  • You would get a 500 error code and a fatal error

With this PR:

  • You would get a 400 error code telling you that you didnt include the required consent argument and no fatal error

  • Do a POST request to https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_configuration_permanent_dismissal with no body

Without this PR:

  • You would get a 500 error code and a fatal error

With this PR:

  • You would get a 400 error code telling you that you didnt include the required is_dismissed argument and no fatal error

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:

  • In a fresh site, do a POST request to https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_manage_consent with { "consent": true } body
  • Go to the wp_options table and confirm that your site_kit_connected option is 1.
  • Now do a POST request to https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_manage_consent with { "consent": false} body
  • Go to the wp_options table and confirm that your site_kit_connected option is 0.
  • In a fresh site, do a POST request to https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_configuration_permanent_dismissal with { "is_dismissed": false } body
  • Go to the wp_options table and confirm that your site_kit_configuration_permanently_dismissed option is 1.
  • Now do a POST request to https://YOUR_WORDPRESS_SITE/wp-json/yoast/v1/site_kit_manage_consent with { "is_dismissed": false} body
  • Go to the wp_options table and confirm that your site_kit_configuration_permanently_dismissed option is 0.

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 https://github.com/Yoast/reserved-tasks/issues/437

@coveralls
Copy link

Pull Request Test Coverage Report for Build a67c3592f0f5ecaed748a247a105d5caaad4aa68

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.009%) to 54.504%

Totals Coverage Status
Change from base Build 6432da1eeec3e2c672bc1d771d33639d647ecde2: 0.009%
Covered Lines: 30208
Relevant Lines: 55850

💛 - Coveralls

@leonidasmi leonidasmi marked this pull request as ready for review February 5, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants