site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Update format of nonce error with help

Open aaemnnosttv opened this issue 1 year ago • 5 comments

Feature Description

In #5482 we introduced a "get help" link in our invalid nonce error which we later flagged as potentially benefiting from a modified format https://github.com/google/site-kit-wp/issues/5482#issuecomment-1212368075.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The format of the custom invalid nonce error displayed for invalid proxy nonces should be adjusted as follows (actual URLs have been omitted as these should not change)

    The link you followed has expired.

    Please try again. Retry didn’t work? Get help

Implementation Brief

  • In includes/Core/Authentication/Authentication.php:
    • Locate the invalid_nonce_error method. Inside the method:
      • In the $html variable concatenation assignment where the links Please try again and Get help are displayed, add the text in between to match the ACs.
      • Ensure that the text is translatable including any concatenation is translatable.

Test Coverage

  • In tests/phpunit/integration/Core/Authentication/AuthenticationTest.php:
    • Update both test_handle_proxy_permissions and test_invalid_nonce_error_sitekit_action test cases to include the updated error message format.

QA Brief

  • Go to the Site Kit splash screen in the not connected state.
  • Add the following snippet of code to your functions.php file:
    add_filter( 'nonce_life', 'wp_nonce_life_filter' );
    function wp_nonce_life_filter(){
        return 1;
    }
    
  • Try to connect Site Kit and you should see the nonce error.
  • Verify that the nonce error format matches the ACs.

Changelog entry

  • N/A

aaemnnosttv avatar Aug 24 '22 18:08 aaemnnosttv

@felixarntz should we update the usage to be consistent with other cases as in https://github.com/google/site-kit-wp/issues/5482#issuecomment-1215228668?

aaemnnosttv avatar Aug 24 '22 18:08 aaemnnosttv

@aaemnnosttv Yeah I think that would make sense. We could simply add the Retry didn't work? bit before the Get help link.

felixarntz avatar Aug 24 '22 18:08 felixarntz

@nfmohit I should have highlighted this in the ACs but this is a good example of where the text shouldn't be duplicated in the IB as the quote in the ACs is a stylized quote but the one in the IB is not. This doesn't really need very much for an IB at all to be honest, simply pointing out where the changes should be made along with the estimate should be sufficient as the AC doesn't really leave room for different approaches.

This is basically good to go, I just tweaked the one line.

IB ✅

aaemnnosttv avatar Sep 16 '22 22:09 aaemnnosttv

Understood. Absolutely agreed. Thank you for the explanation, @aaemnnosttv!

nfmohit avatar Sep 20 '22 04:09 nfmohit

QA Update ✅

  • Verified on dev.
  • Verified by following steps mentioned under QAB.
  • Nonce error showing as per AC.
  • On clicking 'get help' link user navigates to https://sitekit.withgoogle.com/documentation/troubleshooting/setup/#link-expired
  • On clicking 'Please try again' link user gets navigates back to dashboard.

https://user-images.githubusercontent.com/94359491/196114235-efd0c7b1-66b9-4ffb-872e-b8c5fd5ffcb1.mp4

mohitwp avatar Oct 17 '22 07:10 mohitwp