Skip to content

Commit

Permalink
Remove deprecated extra_taxonomy_validations preference
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyadsl committed Apr 18, 2023
1 parent 885f048 commit 74cd8ee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
2 changes: 1 addition & 1 deletion core/app/models/spree/taxonomy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Taxonomy < Spree::Base
acts_as_list

validates :name, presence: true
validates :name, uniqueness: true, if: -> { Spree::Config.extra_taxonomy_validations }
validates :name, uniqueness: true

has_many :taxons, inverse_of: :taxonomy
has_one :root, -> { where parent_id: nil }, class_name: "Spree::Taxon", dependent: :destroy
Expand Down
16 changes: 0 additions & 16 deletions core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,6 @@ def allow_promotions_any_match_policy=(value)
# @return [Regexp] Regex to be used in email validations, for example in Spree::EmailValidator
preference :default_email_regexp, :regexp, default: URI::MailTo::EMAIL_REGEXP

# @!attribute [rw] extra_taxonomy_validations
# Use extra validations on Taxonomies in 3.4.0, but default to false so stores can
# upgrade and then fix any now invalid Taxonomies before enabling.
# @return [Boolean]
versioned_preference :extra_taxonomy_validations, :boolean, initial_value: false, boundaries: { "3.4.0.dev" => true }
def extra_taxonomy_validations=(value)
Spree::Deprecation.warn <<~MSG
Solidus will remove `Spree::Config.extra_taxonomy_validations` preference
in the next major release and will always use the extra Taxonomy validations.
Before upgrading to the next major, please fix any now invalid Taxons
and then remove the preference definition in `config/initializers/spree.rb`.
MSG

preferences[:extra_taxonomy_validations] = value
end

# @!attribute [rw] generate_api_key_for_all_roles
# @return [Boolean] Allow generating api key automatically for user
# at role_user creation for all roles. (default: +false+)
Expand Down
16 changes: 0 additions & 16 deletions core/spec/lib/spree/app_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,4 @@ class DummyClass; end;
expect(prefs.mails_from).to eq('[email protected]')
end
end

context 'extra_taxonomy_validations=' do
it 'is deprecated' do
expect(Spree::Deprecation).to receive(:warn).with(/Solidus will remove `Spree::Config.extra_taxonomy_validations`/)

prefs.extra_taxonomy_validations=(false)
end

it "still sets the value so that consumers aren't broken" do
Spree::Deprecation.silence do
prefs.extra_taxonomy_validations=(false)
end

expect(prefs.extra_taxonomy_validations).to eq(false)
end
end
end

0 comments on commit 74cd8ee

Please sign in to comment.