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

Add a deprecation warning for allow_promotions_any_match_policy = true #4991

Merged

Conversation

kennyadsl
Copy link
Member

Summary

We are going to remove this preference in Solidus 4.0, along with the possibility to create promotion rules with the "Any" match policy.

The only accepted value for those who want to upgrade is false.

Ref #4304

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@kennyadsl kennyadsl added the type:enhancement Proposed or newly added feature label Mar 22, 2023
@kennyadsl kennyadsl requested a review from a team as a code owner March 22, 2023 08:36
@kennyadsl kennyadsl self-assigned this Mar 22, 2023
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Mar 22, 2023
core/lib/spree/app_configuration.rb Outdated Show resolved Hide resolved
We are going to remove this preference in Solidus 4.0. The only accepted
value for who wants to upgrade is false.

Ref solidusio#4304
This constant won't be needed anymore in 4.0 when we will remove
the any matching policy for promotion rules.

I tried to use a more simple ActiveSupport::Deprecation::DeprecatedObjectProxy
like:

    MATCH_POLICIES = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
      %w(all any),
      "Spree::Promotion::MATCH_POLICIES is deprecated, please do not use it anymore.",
      Spree::Deprecation
    )

But it prints the deprecation warning twice for some reason. The
approach used in this commit will load the file that contains the
constant only when it's called, which will also print the warning.
@kennyadsl kennyadsl force-pushed the kennyadsl/deprecate-promotion-match-any branch from cd9c7b8 to bc82ebd Compare March 27, 2023 14:09
@kennyadsl kennyadsl merged commit 1c5adde into solidusio:master Mar 29, 2023
@kennyadsl kennyadsl deleted the kennyadsl/deprecate-promotion-match-any branch March 29, 2023 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem type:enhancement Proposed or newly added feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants