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

Show notification when alert fails to change visibility #21671

Merged

Conversation

pls78
Copy link
Member

@pls78 pls78 commented Sep 30, 2024

Context

  • We want to notify the user when it is not possible to change the visibility of a notification or a problem due to some error.

Summary

This PR can be summarized in the following changelog entry:

  • Adds a notification to inform the user when an error occurs while changing the visibility of a notification or a problem.

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 have more than one notification/problem in the alert center, no matter if hidden or visible
  • Visit Yoast SEO -> General
  • In the Network tab of your browser console, either block the requests containing admin-ajax.php or simulate being offline
  • click on the eye icon beside a notification/problem
    • verify a notification such the one in the design appears
    • do not close it and verify it disappears after 4 seconds
  • click on another eye icon and verify you can dismiss the notification with the x button
  • cilck more than one eye icons and verify you see only one notification
  • verify that if you try to toggle a notification the toast says This *notification* can't be hidden at this time. Please try again later., and This problem can't be hidden at this time. Please try again later. otherwise

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 #282

@pls78 pls78 added the changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog label Sep 30, 2024
@coveralls
Copy link

coveralls commented Sep 30, 2024

Pull Request Test Coverage Report for Build 454222fbe114ec259c0357270e4253d261a44a2c

Details

  • 5 of 21 (23.81%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 49.376%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/dashboard/app.js 0 5 0.0%
packages/js/src/dashboard/store/alert-center.js 3 14 21.43%
Totals Coverage Status
Change from base Build 5fe591e4aa7b2ab8e1b7e72a52790da7a6376543: -0.01%
Covered Lines: 25668
Relevant Lines: 53680

💛 - Coveralls

Copy link
Member

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR 🏗️

What should happen when you click multiple and they all go wrong?
We should probably also just toggle the notification, regardless of the error. At least this session the intention was clear

packages/js/src/dashboard/components/alerts-list.js Outdated Show resolved Hide resolved
packages/js/src/dashboard/components/alerts-list.js Outdated Show resolved Hide resolved
packages/js/src/dashboard/components/alerts-list.js Outdated Show resolved Hide resolved
packages/js/src/dashboard/constants/index.js Outdated Show resolved Hide resolved
packages/js/src/dashboard/constants/index.js Outdated Show resolved Hide resolved
@pls78 pls78 force-pushed the show-notification-when-alert-fails-to-change-visibility branch from 4428eea to e9dbd46 Compare October 3, 2024 11:01
Copy link
Member

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR 🏗️

AT ❓
Works nicely in general!
As you noted yourself, the copy of hidden/shown might mismatch
When collapsing the WP menu, the notification does not match it like we do in settings. Does not seem that important to be fair!

packages/js/src/dashboard/store/alert-center.js Outdated Show resolved Hide resolved
packages/js/src/dashboard/store/alert-center.js Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

This seems overkill in a helper? Plus the naming implicates it can be used for anything, while in reality it is very much tied to the alert center?

packages/js/src/dashboard/store/alert-center.js Outdated Show resolved Hide resolved
packages/js/src/dashboard/app.js Show resolved Hide resolved
Copy link
Member

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR ✅

Besides a new ESLint warning and a conflict with trunk 😬

@pls78 pls78 force-pushed the show-notification-when-alert-fails-to-change-visibility branch from 2a332eb to dae2b09 Compare October 10, 2024 14:49
@vraja-pro vraja-pro modified the milestones: 23.7, 23.8 Oct 14, 2024
@vraja-pro
Copy link
Contributor

AC ✅

@vraja-pro vraja-pro merged commit 4325a01 into trunk Oct 14, 2024
17 checks passed
@vraja-pro vraja-pro deleted the show-notification-when-alert-fails-to-change-visibility branch October 14, 2024 08:46
@hardikgohil7988
Copy link

Tested "something went wrong" notification by blocking admin-ajax.php request and by cutting of network.
Tested notification switcing between notification and problem items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants