-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Promotions Environment Configuration #3239
Refactor Promotions Environment Configuration #3239
Conversation
0fd60ea
to
01ceb06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. Much cleaner and should be nicer to use. Probably worth a mention in the release notes as this might change how people have configured custom promotions
152c016
to
f4e901c
Compare
@eric1234 sure, I'll add this to the CHANGELOG but please keep in mind that this should be transparent for users and if they customized the deprecated class, they will receive a deprecation warning with customizations preserved. I've just added some specs around this here to be sure it works as expected: https://github.com/solidusio/solidus/pull/3239/files#diff-31874dd9132638da9df25acb9f1e3d1f |
f4e901c
to
bac9f60
Compare
This allows to remove items from the list of constantized class for a specific preferences set.
This will be helpful to refactor this part with confidence. The important thing here is to have tests around the usage that could be done into stores and extensions, so we are sure to don't break it.
This class is needed to reflect the class/filesystem of other sub-environment classes, like Spree::Core::Environment::Calculators. They are the same thing but they are placed in two different folders without a specific reason.
Spree::Promo::Environment has been deprecated in favor of the new class that will do the exact same thing.
There's no need to redefine it as Spree::Core::Environment::Promotions since it's already that thing, see it's initializer in core/lib/spree/core/environment.rb and that's exactly what we are already doing with calculators.
bac9f60
to
cfada51
Compare
Description
🚨This PR lives on top of #3238 and should be merged after that one. 🚨-> Merged and rebased.At the moment, there are some small issues with how
spree.config.promotions
is defined.First of all, it's an "
Environment
" object, likeSpree::Core::Environment::Calculators
(both include theEnvironmentExtension
concern), but they are in two different places on the filesystem, without any valid reason (only looking at git history).Another issue is that we are currently redefining it every time we create the main Environment object, but that assignment is useless since it's already initialized with the same thing.
This PR fixes these issues and deprecates the old class used to represent
env.promotions
(Spree::Promo::Environment
).Checklist:
- [ ] I have updated Guides and README accordingly to this change (if needed)