CN-754: Fix issue with Contact Form back links #1221
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Fixes Contact Forms "Back" links issues that have emerged since the Triage Page was introduced.
Why (and how)?
The changes to make "Back" links work are quite involved (much less straightforward than I'd anticipated), so I've tried to set out all the relevant context. Let me know if you'd like me to talk you through it - I'd be very happy to.
How the Triage Page works has complicated "Back" links
The programme introducing a Triage Page that sits outside the
di-authentication-frontend
repository has introduced some complexity for determining the correct destination for "Back" links presented to users presented to users in the Contact Forms. Significant contributors to this are that:fromURL
parameter and may include atheme=id_check_app
parameter.Where the
theme=id_check_app
parameter exists, we route the user to Contact Form options specific to the ID Check App. The logic to achieve the necessary redirect is in a new contactUsGetFromTriagePage controller method.The new
prepareBackLink()
functionA new
prepareBackLink()
function has been created to:req.path
(logic described below)fromURL
andtheme
parameter, where applicable.Because
prepareBackLink()
inspectsreq.path
and changes the destination of "Back" links, it has been necessary to update existing tests to accommodate this.Back link on
/contact-us
The "Back" link on
/contact-us
goes to the destination returned bygetSupportLinkUrl()
which returns theurl_for_support_links
environment variable (set to the corresponding Triage Page in all environments)Dynamic back link on
/contact-us-further-information
Because users visiting
/contact-us-further-information
may have come direct from the Triage Page, the "Back" link on/contact-us-further-information
needs to be dynamic, taking users to:/contact-us
(which we can do by checking for the existence of both afromURL
and atheme=id_check_app
parameter)/contact-us
in all other casesBack link on
/contact-us-questions
The "Back link on
/contact-us-questions
goes to/contact-us-further-information
Other cases
If none of the conditions are met,
prepareBackLink()
defaults to returning/contact-us
Change have been demonstrated
Changes to the user interface or content should be demonstrated to Content Design and Interaction Design before being merged. This is to ensure they can make any necessary changes to Figma.
Note: while this PR does not change the UI, it does have potential to impact user journeys, so it has been shown to UCD colleagues.
Performance Analysis have been informed of the change
Related PRs
Please include links to PRs in other repositories relevant to this PR.
Delete this section if not needed.