-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get single page notification button from personalisation API on load #2443
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 11, 2021 17:36
7d4ccc8
to
0daaec7
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 12, 2021 09:46
0daaec7
to
6282744
Compare
danacotoran
changed the title
WIP: get button from personalisation API
Get single page notification button from personalisation API on load
Nov 12, 2021
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 12, 2021 12:28
117501d
to
6282744
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 12, 2021 13:05
c8e31a1
to
7c8480e
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 12, 2021 13:15
aa4e566
to
1be1a48
Compare
barrucadu
reviewed
Nov 12, 2021
...assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js
Outdated
Show resolved
Hide resolved
andysellick
reviewed
Nov 12, 2021
...assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js
Show resolved
Hide resolved
spec/javascripts/components/single-page-notification-button-spec.js
Outdated
Show resolved
Hide resolved
barrucadu
reviewed
Nov 12, 2021
app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb
Outdated
Show resolved
Hide resolved
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 12, 2021 15:33
1be1a48
to
22c3bb2
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 12, 2021 16:23
22c3bb2
to
7f39893
Compare
andysellick
reviewed
Nov 15, 2021
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 15, 2021 09:44
0b6cac3
to
18a8175
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 15, 2021 19:26
18a8175
to
78b21e1
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 15, 2021 19:30
78b21e1
to
b3595d2
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 16, 2021 11:00
b3595d2
to
96e695d
Compare
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 16, 2021 11:41
96e695d
to
f7bfb15
Compare
alex9smith
approved these changes
Nov 16, 2021
andysellick
reviewed
Nov 17, 2021
lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb
Outdated
Show resolved
Hide resolved
...assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js
Outdated
Show resolved
Hide resolved
lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb
Show resolved
Hide resolved
spec/javascripts/components/single-page-notification-button-spec.js
Outdated
Show resolved
Hide resolved
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 17, 2021 10:55
f7bfb15
to
a69b55d
Compare
andysellick
approved these changes
Nov 18, 2021
Introduce JS that calls our personalisation API on page load. If the user is authenticated, and already subscribed to email notifications on the current page, the account-api serves the "Already subscribed" version of the button HTML. Add data attributes for analytics.
danacotoran
force-pushed
the
js-enhancement-single-page-notif-button
branch
from
November 18, 2021 10:08
a69b55d
to
674540b
Compare
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The single page notification button exists in two states: default (unsubscribed) and already subscribed.
If a user is authenticated and already subscribed to email notifications on the current page, the button should say "Stop getting emails about this page". To request the user data for this layer of personalisation, there is a need to bypass the CDN, however it is not practical to serve all such requests from origin (especially on relatively high traffic pages such as the ones it is likely this feature will be added to).
As such the solution we've landed on is to use JS to perform this check on page load as an enhancement.
account-api
serves the button HTML from the/api/personalisation/check-email-subscription
endpoint – if the user is authenticated and already subscribed to the current page, the endpoint serves the "Already subscribed" variant of the button. The button that already exists on the page is replaced with this updated version, so the user can see that they are already subscribed to emails about the current page.