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

Allows disabling individual AI buttons #21457

Merged
merged 9 commits into from
Jul 9, 2024

Conversation

mhkuu
Copy link
Contributor

@mhkuu mhkuu commented Jul 1, 2024

Context

  • We want to allow disabling individual AI buttons. This is because sometimes the content required for the AI to function is too long: the output for the model we employ is 4096 tokens maximum.

Summary

This PR can be summarized in the following changelog entry:

  • Allows disabling the AI buttons for given assessments.

Relevant technical choices:

  • We solved this by adding to the existing Redux store and checking the value when doing the isEnabled check.
  • The handling of the tooltip is moved to the surrounding div of the AIAssessmentFixesButton because there are no mouse events when an element is disabled.
  • All tests where updated to reflect the new behaviours.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Please see the accompanying Premium PR for testing instructions.

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:

  • The AI fixes buttons.

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

@mhkuu mhkuu added innovation Innovative issue. Relating to performance, memory or data-flow. changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog labels Jul 1, 2024
@mhkuu mhkuu added this to the feature/fix-assessments milestone Jul 1, 2024
@coveralls
Copy link

coveralls commented Jul 1, 2024

Pull Request Test Coverage Report for Build 6ce43a3aa2278e335da8cccb15ff8d18a7df0e18

Details

  • 13 of 16 (81.25%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 48.649%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/redux/actions/AIButton.js 3 4 75.0%
packages/js/src/redux/reducers/AIButton.js 3 5 60.0%
Totals Coverage Status
Change from base Build 2197c662f24ce4fe327abf36f49732b2eb02db08: 0.004%
Covered Lines: 25117
Relevant Lines: 53484

💛 - Coveralls

Copy link

github-actions bot commented Jul 3, 2024

@mhkuu Please be aware that following packages have been abandoned and are not actively maintained anymore:

Package name Path
@yoast/babel-preset packages/babel-preset
@yoast/components packages/components
@yoast/e2e-tests packages/e2e-tests
@yoast/helpers packages/helpers
@yoast/jest-preset packages/jest-preset
@yoast/style-guide packages/style-guide

Please consider using the other packages instead.

@coveralls
Copy link

coveralls commented Jul 3, 2024

Pull Request Test Coverage Report for Build c4942e241e7d3261899064d5ebe29ec602515b09

Details

  • 21 of 26 (80.77%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 48.657%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/redux/reducers/AIButton.js 4 5 80.0%
packages/js/src/ai-assessment-fixes/components/ai-assessment-fixes-button.js 11 15 73.33%
Totals Coverage Status
Change from base Build 2197c662f24ce4fe327abf36f49732b2eb02db08: 0.01%
Covered Lines: 25121
Relevant Lines: 53487

💛 - Coveralls

Copy link
Contributor

@Jordi-PV Jordi-PV left a comment

Choose a reason for hiding this comment

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

Great work. I propose to consider keeping the tooltip as it is and change the mouse event to a pointer event. And then handle the tooltip ariaLabel with the disabled state of the button. Let me know if you need me to explain it 😄

@coveralls
Copy link

coveralls commented Jul 9, 2024

Pull Request Test Coverage Report for Build db18fbd20f824f23ce6af4dc90fb85302ff82397

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

  • 20 of 23 (86.96%) changed or added relevant lines in 4 files are covered.
  • 4424 unchanged lines in 143 files lost coverage.
  • Overall coverage decreased (-5.4%) to 48.699%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/redux/reducers/AIButton.js 4 5 80.0%
packages/js/src/ai-assessment-fixes/components/ai-assessment-fixes-button.js 10 12 83.33%
Files with Coverage Reduction New Missed Lines %
admin/class-option-tabs-formatter.php 1 0.0%
src/actions/configuration/first-time-configuration-action.php 1 91.84%
src/builders/indexable-home-page-builder.php 1 98.0%
src/builders/indexable-term-builder.php 1 99.15%
src/context/meta-tags-context.php 1 28.29%
src/editors/framework/site/post-site-information.php 1 93.88%
src/generators/breadcrumbs-generator.php 1 64.23%
src/generators/schema/webpage.php 1 90.32%
src/integrations/blocks/structured-data-blocks.php 1 16.0%
src/integrations/settings-integration.php 1 28.49%
Totals Coverage Status
Change from base Build b961a40c4e03131cc8c75ccf8d5090e5e16f19f9: -5.4%
Covered Lines: 25252
Relevant Lines: 53697

💛 - Coveralls

@mhkuu
Copy link
Contributor Author

mhkuu commented Jul 9, 2024

CR: Looks nice, definitely a nicer solution like this, closer to the original 😸
ACC: Still works as supposed! 🎉

@mhkuu mhkuu merged commit a5c0344 into feature/fix-assessments Jul 9, 2024
16 checks passed
@mhkuu mhkuu deleted the new/allow-disabling-buttons branch July 9, 2024 13:51
@mhkuu mhkuu changed the title Allows disabling AI buttons Allows disabling individual AI buttons Jul 16, 2024
@mhkuu mhkuu modified the milestones: feature/fix-assessments, 23.2 Jul 16, 2024
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 innovation Innovative issue. Relating to performance, memory or data-flow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants