Skip to content

Commit 625aa06

Browse files
Merge pull request #4856 from nebulab/waiting-for-dev/revert_deprecation_of_redirect_back_or_default
Revert the deprecation of `#redirect_back_or_default` method
2 parents 929035c + e823123 commit 625aa06

File tree

4 files changed

+4
-26
lines changed

4 files changed

+4
-26
lines changed

core/app/models/spree/user_last_url_storer.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def self.rules
2626
# or its subclasses. The controller will be passed to each rule for matching.
2727
def initialize(controller)
2828
@controller = controller
29-
Spree::Deprecation.warn("This class will be removed without replacement on the release of Solidus 4.0")
3029
end
3130

3231
# Stores into session[:spree_user_return_to] the request full path for

core/lib/spree/core/controller_helpers/auth.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ def current_ability
3737
end
3838

3939
def redirect_back_or_default(default)
40-
Spree::Deprecation.warn <<~MSG
41-
'Please use #stored_spree_user_location_or when using solidus_auth_devise.
42-
Otherwise, please utilize #redirect_back provided in Rails 5+ or
43-
#redirect_back_or_to in Rails 7+ instead'
44-
MSG
45-
4640
redirect_to(session["spree_user_return_to"] || default)
4741
session["spree_user_return_to"] = nil
4842
end
@@ -57,11 +51,6 @@ def set_guest_token
5751
end
5852

5953
def store_location
60-
Spree::Deprecation.warn <<~MSG
61-
store_location is being deprecated in solidus 4.0
62-
without replacement
63-
MSG
64-
6554
Spree::UserLastUrlStorer.new(self).store_location
6655
end
6756

core/spec/lib/spree/core/controller_helpers/auth_spec.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def index; render plain: 'index'; end
1717
describe '#redirect_back_or_default' do
1818
before do
1919
def controller.index
20-
Spree::Deprecation.silence { redirect_back_or_default('/') }
20+
redirect_back_or_default('/')
2121
end
2222
end
2323

@@ -30,11 +30,6 @@ def controller.index
3030
get :index
3131
expect(response).to redirect_to('/')
3232
end
33-
34-
it 'is deprecated' do
35-
expect(Spree::Deprecation).to receive(:warn)
36-
get :index
37-
end
3833
end
3934

4035
describe '#set_guest_token' do
@@ -74,7 +69,7 @@ def controller.index
7469
describe '#store_location' do
7570
it 'sets session return url' do
7671
allow(controller).to receive_messages(request: double(fullpath: '/redirect'))
77-
Spree::Deprecation.silence { controller.store_location }
72+
controller.store_location
7873
expect(session[:spree_user_return_to]).to eq '/redirect'
7974
end
8075
end

core/spec/models/spree/user_last_url_storer_spec.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ def self.match?(_controller)
2727
described_class.rules.delete('CustomRule')
2828
end
2929

30-
it 'is deprecated' do
31-
expect(Spree::Deprecation).to receive(:warn)
32-
described_class.new(controller)
33-
end
34-
3530
describe '::rules' do
3631
it 'includes default rules' do
3732
rule = Spree::UserLastUrlStorer::Rules::AuthenticationRule
@@ -48,7 +43,7 @@ def self.match?(_controller)
4843
context 'when at least one rule matches' do
4944
it 'does not set the path value into the session' do
5045
described_class.rules << CustomRule
51-
Spree::Deprecation.silence { subject.store_location }
46+
subject.store_location
5247
expect(session[:spree_user_return_to]).to be_nil
5348
end
5449
end
@@ -57,7 +52,7 @@ def self.match?(_controller)
5752
it 'sets the path value into the session' do
5853
described_class.rules << CustomRule
5954
described_class.rules.delete('CustomRule')
60-
Spree::Deprecation.silence { subject.store_location }
55+
subject.store_location
6156
expect(session[:spree_user_return_to]).to eql fullpath
6257
end
6358
end

0 commit comments

Comments
 (0)