site-kit-wp: Add a "get help" link to the "reconnect_after_url_mismatch" notice.
Feature Description
We need to add a new “Get Help” link to the notification that appears when site has changed its URL. The URL for the new “get help” link should be obtained using the getDocumentationLinkURL selector introduced in https://github.com/google/site-kit-wp/issues/5423.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The “reconnect after url mismatch” notification should display a new “Get Help” link that leads to the
{proxy}/support/?doc=url-has-changedURL.
Implementation Brief
- In
includes/Core/Authentication/Authentication.php:- Locate the
get_reconnect_after_url_mismatch_noticemethod. - Inside the method’s
Noticeclass definition, in the second parameter array, locate the function in thecontentproperty. - Inside the function, when the
$contentvariable is assigned, add a full stop after the closing</a>tag. After the full stop, add a new<a>tag withhrefattribute having the fifth placeholder (%5$s- the support link) and the content as the sixth placeholder (%6$s- the get help string). It should also have atargetattribute with the value of_blank. https://github.com/google/site-kit-wp/blob/4306cdda53c54ee2a4dcc16cbd9459352d9c0c9b/includes/Core/Authentication/Authentication.php#L1116- The fifth placeholder value should be
/?doc=url-has-changedappended to theget_proxy_support_link_url()method of the sameAuthenticationclass. It should be escaped withesc_url(). - The sixth placeholder should be
Get Help(translatable).
- The fifth placeholder value should be
- Locate the
- In
assets/js/components/setup/SetupUsingProxyWithSignIn.js:- Compose the “Get Help” link URL:
- Use the
getDocumentationLinkURLselector with the slugurl-has-changedfrom thecore/sitestore and assign it in a variable namedurlHasChangedHelpLink(or something more relevant).
- Use the
- Create a new reassignable variable named
getHelp. - After the
descriptionis displayed, check ifgetHelpis truthy and if so, display a<Link />component with anhrefprop pointing to thegetHelpvariable and anexternalprop withtrue. The content of the component should beGet Help(translatable). https://github.com/google/site-kit-wp/blob/4ebc69975bc624731085b12974fbb44142eb060c/assets/js/components/setup/SetupUsingProxyWithSignIn.js#L303-L305 - In the case where
DISCONNECTED_REASON_CONNECTED_URL_MISMATCH === disconnectedReasonis true andurlHasChangedHelpLinkis truthy, assignurlHasChangedHelpLinkto thegetHelpvariable. https://github.com/google/site-kit-wp/blob/4306cdda53c54ee2a4dcc16cbd9459352d9c0c9b/assets/js/components/setup/SetupUsingProxyWithSignIn.js#L207-L215
- Compose the “Get Help” link URL:
Test Coverage
- Verify the
Setup -> Using Proxy with Sign-in -> Disconnected - URL Mismatchstories. - Update VRT images if required.
QA Brief
- Locate the Setup -> Using Proxy with Sign-in -> Disconnected - URL Mismatch story in storybook
- Verify that a new Get help-link has been added below the description
- Verify that the link opens in a new tab and that the URL is
<proxiedSupportURL>/?doc=url-has-changed
- Create a new site and sign in with Site Kit.
- Change the URL of the site so Site Kit shows the “URL Mismatch notice” when accessing the dashboard.
- Verify there is now a “Get help” link beneath the URL mismatch notice message and it opens a
?/doc=url-has-changedlink in a new tab.
Changelog entry
- Add a help link to the “site URL has changed” notice when Site Kit detects your site URL has changed.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (1 by maintainers)
Commits related to this issue
- Merge branch 'enhancement/##5481-add-get-help' of github.com:google/site-kit-wp into enhancement/##5481-add-get-help. — committed to google/site-kit-wp by tofumatt 2 years ago
- Merge pull request #5636 from google/enhancement/##5481-add-get-help Add a get help link to mismatched url errors. — committed to google/site-kit-wp by tofumatt 2 years ago
IB ✔️
Thank you @eugene-manuilov! I’ve updated the IB so that the
Get Helplink appears right after theReconnectlink.Same here, no need to put it into a separate
<p>tag. It should go in the same paragraph.Thanks, @nfmohit. Mostly looks good to me. Have a few comments:
No need to put the new link into a separate
<p>tag, it will make the link appear below the notice message. We need to add the get help link after the reconnect one.How about
urlHasChangedHelpLink?