site-kit-wp: Update ReportError to use module specific ids of the insufficient permissions error when we build the get help link
Feature Description
The insufficient permissions error has no error code, so when we build a get help link only error message is used. We need to generate a fake error code for the insufficient permissions error in the ReportError component to allow the support team to redirect users to module-specific articles.
So, instead of passing an error to the getErrorTroubleshootingLinkURL selector directly, we need to check if this error is the insufficient permissions error and add ${ moduleSlug }_insufficient_permissions error code.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The Get Help link in the
ReportErrorcomponent for the insufficient permissions error should have module specific error code:${ moduleSlug }_insufficient_permissions.
Implementation Brief
In assets/js/components/ReportError.js, add the following changes:
- Map the
errorsarray and check if the error object has an insufficient permissions error using theisInsufficientPermissionsErrorhelper. - If it is, return the existing error object and add the module slug to the error code -
code: ${ moduleSlug }_insufficient_permissions. - If it is not, then return the existing error object.
Test Coverage
In assets/js/components/ReportError.test.js, add test coverage to check the getErrorTroubleshootingLinkURL selector returns the correct URL for the insufficient permissions error with the error code for the Get help link.
QA Brief
- Trigger the Insufficient permissions error on any module (for e.g Analytics). For e.g setup Analytics as another user and don’t grant permissions to a user.
- Check the “Get help” URL contains the following string:
error_id=analytics_insufficient_permissionswhereanalyticsis the module slug.
Changelog entry
- Update the
ReportErrorcomponent to add the module slug to the insufficient error codes.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (3 by maintainers)
@felixarntz please see my comments on your PR, but TL;DR this shouldn’t be necessary 👍
@felixarntz @jamesozzie the CSV with the latest error redirects mapping has been uploaded to production and new redirects work now: https://sitekit.withgoogle.com/support/?error_id=search-console_insufficient_permissions
@jamesozzie this one should be
search-console_insufficient_permissions, other look good.