Refactor: Improve SalesBanner Maintainability #7454
Closed
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.
Resolves: GIVE-1020
Description
This pull request enhances the extensibility of the main SalesBanner class by refactoring the GivingTuesdayBanner details into its own dedicated class. This separation improves maintainability and makes it easier to extend the functionality in the future.
In relation to GIVE-1020, a user was encountering a fatal error that we were unable to replicate. However, Rick provided a workaround that alleviated the issue for the user. This involved ensuring that the isShowing logic for GivingTuesdayBanner returns false when it should not load. One issue we noticed in the original implementation is that the
SalesBanner
class was unnecessarily loading scripts because this logic only checked if a user was on a "give-forms" page.In the newly created GivingTuesdayBanner class, the isShowing method has been updated with a conditional check, ensuring that banner scripts only load when banners are available. This change aims to provide relief to users experiencing similar issues and improves the overall maintainability of the class.
Affects
SalesBanners
Visuals
Testing Instructions
We should retest the current banners to ensure they continue to work.
Admin Banners
Reports Widget Banners
Pre-review Checklist
@unreleased
tags included in DocBlocks