Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
fixed deprecation warning, removed methods deprecated ages ago
Damian Legawiec671334f5d93d
diff --git a/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb b/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rbindex 81f9521f19..7d4c26b3de 100644--- a/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb+++ b/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb@@ -39,10 +39,7 @@ module Spreeenddef serialize_order(order)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `OrderConcern#serialize_order` is deprecated and will be removed in Spree 5.0.- Please use `serializer_resource` method- DEPRECATION+ Spree::Deprecation.warn('OrderConcern#serialize_order is deprecated and will be removed in Spree 6.0. Please use `serialize_resource` method')serialize_resource(order)endenddiff --git a/core/app/finders/spree/countries/find.rb b/core/app/finders/spree/countries/find.rbindex e926afb215..932ccf23ea 100644--- a/core/app/finders/spree/countries/find.rb+++ b/core/app/finders/spree/countries/find.rb@@ -7,14 +7,6 @@ module Spree@shippable = String(params[:filter][:shippable]) unless params[:filter].nil?end- def call- Spree::Deprecation.warn(<<-DEPRECATION, caller)- Spree::Countries::Find.new.call is deprecated and will be removed in Spree 5.0.- Please use Spree::Countries::Find.new.execute instead- DEPRECATION- execute- end-def executecountries = by_shippability(scope)diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rbindex 32e1a43ab0..76f5a5708a 100644--- a/core/app/helpers/spree/base_helper.rb+++ b/core/app/helpers/spree/base_helper.rb@@ -136,10 +136,7 @@ module Spreedef pretty_time(time)return '' if time.blank?- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `BaseHelper#pretty_time` is deprecated and will be removed in Spree 6.0.- Please add `local_time` gem to your Gemfile and use `local_time(time)` instead- DEPRECATION+ Spree::Deprecation.warn('BaseHelper#pretty_time is deprecated and will be removed in Spree 6.0. Please add `local_time` gem to your Gemfile and use `local_time(time)` instead')[I18n.l(time.to_date, format: :long), time.strftime('%l:%M %p %Z')].join(' ')end@@ -147,10 +144,7 @@ module Spreedef pretty_date(date)return '' if date.blank?- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `BaseHelper#pretty_date` is deprecated and will be removed in Spree 6.0.- Please add `local_time` gem to your Gemfile and use `local_date(date)` instead- DEPRECATION+ Spree::Deprecation.warn('BaseHelper#pretty_date is deprecated and will be removed in Spree 6.0. Please add `local_time` gem to your Gemfile and use `local_date(date)` instead')[I18n.l(date.to_date, format: :long)].join(' ')end@@ -219,19 +213,13 @@ module Spree# we should always try to render image of the default variant# same as it's done on PDPdef default_image_for_product(product)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `BaseHelper#default_image_for_product` is deprecated and will be removed in Spree 6.0.- Please use `product.default_image` instead- DEPRECATION+ Spree::Deprecation.warn('BaseHelper#default_image_for_product is deprecated and will be removed in Spree 6.0. Please use product.default_image instead')product.default_imageenddef default_image_for_product_or_variant(product_or_variant)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `BaseHelper#default_image_for_product_or_variant` is deprecated and will be removed in Spree 6.0.- Please use `product_or_variant.default_image` instead- DEPRECATION+ Spree::Deprecation.warn('BaseHelper#default_image_for_product_or_variant is deprecated and will be removed in Spree 6.0. Please use product_or_variant.default_image instead')product_or_variant.default_imageenddiff --git a/core/app/helpers/spree/products_helper.rb b/core/app/helpers/spree/products_helper.rbindex 91537a3886..b99c616440 100644--- a/core/app/helpers/spree/products_helper.rb+++ b/core/app/helpers/spree/products_helper.rb@@ -121,10 +121,7 @@ module Spreeenddef related_products- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ProductsHelper#related_products is deprecated and will be removed in Spree 5.0.- Please use ProductsHelper#relations from now on.- DEPRECATION+ Spree::Deprecation.warn('ProductsHelper#related_products is deprecated and will be removed in Spree 6.0. Please use ProductsHelper#relations from now on.')return [] unless @product.respond_to?(:has_related_products?)diff --git a/core/app/models/spree/product_property.rb b/core/app/models/spree/product_property.rbindex 20e2bca9c2..55023a1d72 100644--- a/core/app/models/spree/product_property.rb+++ b/core/app/models/spree/product_property.rb@@ -42,19 +42,6 @@ module Spree# virtual attributes for use with AJAX completion stuffdelegate :name, :presentation, to: :property, prefix: true, allow_nil: true- def property_name=(name)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `ProductProperty#property_name=` is deprecated and will be removed in Spree 5.0.- DEPRECATION- if name.present?- self.property = if Property.where(name: name).exists?- Property.where(name: name).first- else- Property.create(name: name, presentation: name)- end- end- end-protecteddef param_candidatediff --git a/core/app/validators/db_maximum_length_validator.rb b/core/app/validators/db_maximum_length_validator.rbdeleted file mode 100644index a5e9d0c383..0000000000--- a/core/app/validators/db_maximum_length_validator.rb+++ /dev/null@@ -1,16 +0,0 @@-##-# Validates a field based on the maximum length of the underlying DB field, if there is one.-class DbMaximumLengthValidator < ActiveModel::EachValidator- def validate_each(record, attribute, value)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `DbMaximumLengthValidator` is deprecated and will be removed in Spree 5.0.- Please remove any `db_maximum_length: true` validations from your codebase- DEPRECATION-- limit = record.class.columns_hash[attribute.to_s].limit- value = record[attribute.to_sym]- if value && limit && value.to_s.length > limit- record.errors.add(attribute.to_sym, :too_long, count: limit)- end- end-enddiff --git a/core/lib/spree/core/controller_helpers/common.rb b/core/lib/spree/core/controller_helpers/common.rbindex 9bdbea7a57..ae0647dd4a 100644--- a/core/lib/spree/core/controller_helpers/common.rb+++ b/core/lib/spree/core/controller_helpers/common.rb@@ -2,77 +2,6 @@ module Spreemodule Coremodule ControllerHelpersmodule Common- extend ActiveSupport::Concern- included do- helper_method :title- helper_method :title=- helper_method :accurate_title-- layout :get_layout-- protected-- # can be used in views as well as controllers.- # e.g. <% self.title = 'This is a custom title for this view' %>- attr_writer :title-- def title- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.- DEPRECATION- title_string = @title.present? ? @title : accurate_title- if title_string.present?- if Spree::Config[:always_put_site_name_in_title] && !title_string.include?(default_title)- [title_string, default_title].join(" #{Spree::Config[:title_site_name_separator]} ")- else- title_string- end- else- default_title- end- end-- def default_title- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.- DEPRECATION- current_store.name- end-- # this is a hook for subclasses to provide title- def accurate_title- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.- DEPRECATION- current_store.seo_title- end-- private-- def set_user_language- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerHelpers::Common#set_user_language is deprecated and will be removed in Spree 5.0.- Please use `before_action :set_locale` instead- DEPRECATION-- set_locale- end-- # Returns which layout to render.- #- # You can set the layout you want to render inside your Spree configuration with the +:layout+ option.- #- # Default layout is: +app/views/spree/layouts/spree_application+- #- def get_layout- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.- DEPRECATION- return unless defined?(Spree::Frontend)-- layout ||= Spree::Frontend::Config[:layout]- end- endendendenddiff --git a/core/lib/spree/core/engine.rb b/core/lib/spree/core/engine.rbindex cda0cf5e79..9c0781e227 100644--- a/core/lib/spree/core/engine.rb+++ b/core/lib/spree/core/engine.rb@@ -42,7 +42,7 @@ module SpreeSpree::Config = app.config.spree.preferencesSpree::RuntimeConfig = app.config.spree.preferences # for compatibilitySpree::Dependencies = app.config.spree.dependencies- Spree::Deprecation = ActiveSupport::Deprecation.new+ Spree::Deprecation = ActiveSupport::Deprecation.new('6.0', 'Spree')endinitializer 'spree.register.calculators', before: :after_initialize do |app|diff --git a/core/lib/spree/testing_support/controller_requests.rb b/core/lib/spree/testing_support/controller_requests.rbindex 52c02a1689..acdd92492b 100644--- a/core/lib/spree/testing_support/controller_requests.rb+++ b/core/lib/spree/testing_support/controller_requests.rb@@ -6,98 +6,6 @@ module Spreeincluded doroutes { Spree::Core::Engine.routes }end-- def spree_get(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_get is deprecated and will be removed in Spree 5.0.- Please use get, params: {}- DEPRECATION- process_spree_action(action, parameters, session, flash, 'GET')- end-- # Executes a request simulating POST HTTP method and set/volley the response- def spree_post(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_post is deprecated and will be removed in Spree 5.0.- Please use post, params: {}- DEPRECATION- process_spree_action(action, parameters, session, flash, 'POST')- end-- # Executes a request simulating PUT HTTP method and set/volley the response- def spree_put(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_put is deprecated and will be removed in Spree 5.0.- Please use put, params: {}- DEPRECATION- process_spree_action(action, parameters, session, flash, 'PUT')- end-- # # Executes a request simulating PATCH HTTP method and set/volley the response- def spree_patch(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_patch is deprecated and will be removed in Spree 5.0.- Please use patch, params: {}- DEPRECATION- process_spree_action(action, parameters, session, flash, 'PATCH')- end-- # Executes a request simulating DELETE HTTP method and set/volley the response- def spree_delete(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_delete is deprecated and will be removed in Spree 5.0.- Please use delete, params: {}- DEPRECATION- process_spree_action(action, parameters, session, flash, 'DELETE')- end-- def spree_xhr_get(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_xhr_get is deprecated and will be removed in Spree 5.0.- DEPRECATION- process_spree_xhr_action(action, parameters, session, flash, :get)- end-- def spree_xhr_post(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_xhr_post is deprecated and will be removed in Spree 5.0.- DEPRECATION- process_spree_xhr_action(action, parameters, session, flash, :post)- end-- def spree_xhr_put(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_xhr_put is deprecated and will be removed in Spree 5.0.- DEPRECATION- process_spree_xhr_action(action, parameters, session, flash, :put)- end-- def spree_xhr_patch(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_xhr_patch is deprecated and will be removed in Spree 5.0.- DEPRECATION- process_spree_xhr_action(action, parameters, session, flash, :patch)- end-- def spree_xhr_delete(action, parameters = nil, session = nil, flash = nil)- Spree::Deprecation.warn(<<-DEPRECATION, caller)- ControllerRequests#spree_xhr_delete is deprecated and will be removed in Spree 5.0.- DEPRECATION- process_spree_xhr_action(action, parameters, session, flash, :delete)- end-- private-- def process_spree_action(action, parameters = nil, session = nil, flash = nil, method = 'GET')- parameters ||= {}- process(action, method: method, params: parameters, session: session, flash: flash)- end-- def process_spree_xhr_action(action, parameters = nil, session = nil, flash = nil, method = :get)- parameters ||= {}- parameters.reverse_merge!(format: :json)- process(action, method: method, params: parameters, session: session, flash: flash, xhr: true)- endendendenddiff --git a/core/spec/models/spree/product_property_spec.rb b/core/spec/models/spree/product_property_spec.rbindex 6ab638c9be..16712aa7ef 100644--- a/core/spec/models/spree/product_property_spec.rb+++ b/core/spec/models/spree/product_property_spec.rb@@ -54,18 +54,6 @@ describe Spree::ProductProperty, type: :model doendend- context 'property_name=' do- before do- @pp = create(:product_property)- end-- it 'assigns property' do- @pp.property_name = 'Size'- expect(@pp.property.name).to eq('size')- expect(@pp.property.presentation).to eq('Size')- end- end-context 'ransackable_associations' doit { expect(described_class.whitelisted_ransackable_associations).to include('property') }end