You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix GOV.UK Chat promo on pages with multiple path segments
We have an allow list of URLs on which we want to render the GOV.UK Chat
promo, which we compare the content item's `base_path` against to
determine whether to show the promo or not.
This results in a bug in some guide pages where we only want to show the
promo on certain steps of the guide.
Let's consider the "/contracted-out" URL. This guide has 3 steps, and so
3 URLs
1. /contracted-out
2. /contracted-out/how-contracting-out-affects-your-amount
3. /contracted-out/check-if-you-were-contracted-out
We only want to show the promo on URL 1 and 3 in the list above, but not
the second one.
With the current logic, we're showing the promo on all of these URLs.
That's because we're looking at the `content_item.base_path` property,
which is "/contracted-out" for all of those URLs.
Instead we should do the comparison on the `requested_path` method,
which is the full path.
It also fixes a bug in a similar vein where we want to show the promo on
only one of the sub-pages in a guide (e.g. URL 2 above), but because
we're comparing against the `base_path`, we end up showing it on all
pages of the guide.
0 commit comments