Skip to content

Disable AI Optimize button in taxonomies#22246

Merged
mhkuu merged 3 commits intofeature/ai-optimize-classicfrom
4614-ai-optimize-tinymce---remove-feature-for-terms
May 9, 2025
Merged

Disable AI Optimize button in taxonomies#22246
mhkuu merged 3 commits intofeature/ai-optimize-classicfrom
4614-ai-optimize-tinymce---remove-feature-for-terms

Conversation

@FAMarfuaty
Copy link
Copy Markdown
Contributor

@FAMarfuaty FAMarfuaty commented May 8, 2025

Context

  • We don't want to make the AI Optimize feature available in terms for now. This PR ensures that the AI Optimize button is not shown in terms (in Free).

Summary

This PR can be summarized in the following changelog entry:

  • Removes AI Optimize button from taxonomies.

Relevant technical choices:

  • In Premium, through the Post_Conditional, we already ensured the AI Optimize integration is not loaded.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

Test only in Free

  • Install and activate Yoast SEO
  • Install and activate Classic editor
Taxonomies
  • Create a taxonomy
    • The test should be executed in tags, categories, custom taxonomies, WooCommerce Brands, WooCommerce categories, WooCommerce tags, and WooCommerce attributes
  • Set the focus keyphrase
  • Add some contents so that you get 🔴 red or 🟠 orange feedback for the following assessments: Keyphrase density, keyphrase in introduction, sentence length and paragraph length assessment
  • Confirm that you don't see the AI Optimize button for the aforementioned assessments
Smoke test in non-taxonomies
  • Create a post
  • Set the focus keyphrase
  • Add some contents so that you get 🔴 red or 🟠 orange feedback for the following assessments: Keyphrase density, keyphrase in introduction, sentence length and paragraph length assessment
  • Confirm that you still see the AI Optimize button for the aforementioned assessments
  • Clicking on the AI button will display the upsell modal
Smoke test in non-classic editor
  • Deactivate Classic editor
  • Create a post
  • Set the focus keyphrase
  • Add some contents so that you get 🔴 red or 🟠 orange feedback for the following assessments: Keyphrase density, keyphrase in introduction, sentence length and paragraph length assessment
  • Confirm that you still see the AI Optimize button for the aforementioned assessments
  • Clicking on the AI button will display the upsell modal

Note

Smoke testing only in Free should be sufficient

Test with Premium

  • Install and activate Yoast SEO
  • Install and activate Yoast SEO Premium
    • Acceptance test/CR: Please pair this branch with feature/ai-optimize-classic branch in Premium. Refer to this page for information on how to test the AI feature in staging
  • Install and activate Classic editor
Taxonomies
  • Create a taxonomy
    • The test should be executed in tags, categories, custom taxonomies, WooCommerce Brands, WooCommerce categories, WooCommerce tags, and WooCommerce attributes
  • Set the focus keyphrase
  • Add some contents so that you get 🔴 red or 🟠 orange feedback for the following assessments: Keyphrase density, keyphrase distribution, keyphrase in introduction, sentence length and paragraph length assessment
  • Confirm that you don't see the AI Optimize button for the aforementioned assessments

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.

QA can test this PR by following these steps:

Impact check

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

  • See the testing instruction. No further impact other than what's covered in the testing instruction

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

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/wordpress-seo-premium/issues/4614

@FAMarfuaty FAMarfuaty added this to the feature/ai-optimize-classic milestone May 8, 2025
@FAMarfuaty FAMarfuaty added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label May 8, 2025
@FAMarfuaty FAMarfuaty marked this pull request as ready for review May 8, 2025 09:14
@FAMarfuaty FAMarfuaty requested a review from Copilot May 8, 2025 09:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request disables the AI Optimize button for taxonomy pages by introducing an additional condition to check if the current page is a term page. Key changes include:

  • Updating the helper function shouldRenderAIOptimizeButton to include the isTerm parameter.
  • Modifying component logic in SeoAnalysis and ReadabilityAnalysis to respect the new isTerm condition.
  • Adding new tests to verify the correct behavior when isTerm is true.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/js/tests/helpers/shouldRenderAIOptimizeButton.test.js Added tests for the new isTerm condition.
packages/js/src/helpers/shouldRenderAIOptimizeButton.js Modified function signature and logic to check isTerm.
packages/js/src/components/contentAnalysis/SeoAnalysis.js Updated prop handling and logic to include isTerm.
packages/js/src/components/contentAnalysis/ReadabilityAnalysis.js Updated prop handling and logic to include isTerm.

@coveralls
Copy link
Copy Markdown

coveralls commented May 8, 2025

Pull Request Test Coverage Report for Build 7890eaf6f2557c09d109ee7585efbdac80881bb8

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

  • 2 of 6 (33.33%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.01%) to 52.809%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/components/contentAnalysis/ReadabilityAnalysis.js 0 2 0.0%
packages/js/src/components/contentAnalysis/SeoAnalysis.js 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
packages/js/src/components/contentAnalysis/ReadabilityAnalysis.js 1 0.0%
packages/js/src/components/contentAnalysis/SeoAnalysis.js 1 0.0%
Totals Coverage Status
Change from base Build bd4fb5b465aecaf6795c5e18878a3b74fd4847b4: 0.01%
Covered Lines: 29571
Relevant Lines: 57120

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@mhkuu mhkuu left a comment

Choose a reason for hiding this comment

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

Looks good! 🎉 I'm going to remove one test case as it's superfluous.

Comment thread packages/js/tests/helpers/shouldRenderAIOptimizeButton.test.js Outdated
@mhkuu
Copy link
Copy Markdown
Contributor

mhkuu commented May 9, 2025

ACC: passed! 🎉

@mhkuu mhkuu merged commit 939b4be into feature/ai-optimize-classic May 9, 2025
20 checks passed
@mhkuu mhkuu deleted the 4614-ai-optimize-tinymce---remove-feature-for-terms branch May 9, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants