Skip to content
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

Refactor single page notification button logic prior to adding new functionality #2593

Merged
merged 4 commits into from
Nov 7, 2022

Conversation

hannako
Copy link
Contributor

@hannako hannako commented Nov 4, 2022

There are no user facing changes here, it's just a reorganisation of the existing code.

We will soon be wanting to add the button to a new document type (document collections) with custom button text, so doing a bit of a tidy up first to make the code easier to extend.

See commit messages for more detail.

https://trello.com/c/gpch42Uc/1456-enable-custom-text-for-the-single-page-notification-button-component-l

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

- Rather than set an environment variable in the controller which is available to all
the views, we should control whether or not we show the button template in the
presenter.
- I've removed the ALLOWED_DOCUMENT_TYPES because if we only include the
ContentItem::SinglePageNotificationButton module in the presenter classes of content
types which we want to show the button, the effect is the same. It's also a bit misleading
having an allow list because it infers there's a reason some types can't support email
subscriptions. This is not the case - email alert API doesn't care.

- This pattern of including a module into the document type specific presenter
is more consistent with this repo, and other frontend repos.
Currently we are requiring the single page notification button module
in all the subclasses inheriting from ContentItemPresenter. We will be adding
more into this module in coming work, so it's a good idea to remove unecessary
coupling now.
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2593 November 4, 2022 16:10 Inactive
@hannako hannako changed the title Refactor single page notification button logic prior to adding new funcationality Refactor single page notification button logic prior to adding new functionality Nov 4, 2022
@hannako hannako requested a review from chao-xian November 7, 2022 12:22
@hannako hannako merged commit 38faada into main Nov 7, 2022
@hannako hannako deleted the refactor_button_code branch November 7, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants