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

2777 inactive actionless promotions #3596

Conversation

wildbillcat
Copy link
Contributor

Description
This is a proposed solution to #2777 where action-less promotions were considered active. As opposed to my original thought of implementing validation, given that there is no state toggle on the promotion that it would make sense to embrace the inferred state. So this implementation just causes a promotion to be considered inactive until it has actions, in addition to the other required material. Otherwise it is considered inactive.

In the process I found the coupon promotion handler already treated action-less coupons as inactive, so I updated it to continue this behavior.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

core/lib/spree/core/engine.rb Outdated Show resolved Hide resolved
core/app/models/spree/promotion_handler/coupon.rb Outdated Show resolved Hide resolved
@wildbillcat wildbillcat force-pushed the 2777-inactive-actionless-promotions branch 3 times, most recently from c42a852 to df21004 Compare April 27, 2020 02:24
@@ -202,6 +202,10 @@ class AppConfiguration < Preferences::Configuration
# @return [Integer] Promotions to show per-page in the admin (default: +15+)
preference :promotions_per_page, :integer, default: 15

# @!attribute [rw] disable_actionless_promotion_validation
# @return [Boolean] Promotions should have actions associated before activation (default: +true+)
preference :actionless_promotion_inactive, :boolean, default: true
Copy link
Member

@kennyadsl kennyadsl May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't really reviewed the PR yet but in the meantime, I think this should be changed. The default value should be the one that represents the old behavior (false in this case). This way, users that upgrade Solidus will keep having the same behavior and will see a deprecation warning. They will have the chance to take a look at what happens before switching the value.

New Solidus users will have the new version of spree.rb initializer instead and they will start their apps with the new default.

How does it sound?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries and sounds fine. This will probably take me a little while as the change of function appears to break a lot of tests, so I need to reconcile the change across functions.

@aldesantis aldesantis added this to the 2.11 milestone May 22, 2020
@aldesantis
Copy link
Member

@wildbillcat I'd love to get this into 2.11, which will be the last release in the 2.x branch. That way, we can completely remove the old behavior in 3.0. Let me know if you think it's doable!

@wildbillcat
Copy link
Contributor Author

No Idea haha. But holiday weekend, so I'll see if I can sort out the issues this weekend.
If not I'll note where I could use some help, the change of behavior results in a good portion of the test suite failing out. So I have to reconcile that back into green 👍

@wildbillcat
Copy link
Contributor Author

@aldesantis Apologies, had some work stuff come up over the weekend that kept me from working on this. I'll pick this up this evening and try to have an update for you Friday. Cheers,

@wildbillcat wildbillcat force-pushed the 2777-inactive-actionless-promotions branch from db12407 to 527b8dd Compare June 7, 2020 02:39
@kennyadsl
Copy link
Member

Closing in favor of #3749, thanks!

@kennyadsl kennyadsl closed this Sep 8, 2020
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.

4 participants