Skip to content

Commit

Permalink
Improve deprecation messages for the Auth module
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Jan 12, 2023
1 parent accab6d commit ee8cb5c
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions core/lib/spree/core/controller_helpers/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ def current_ability
end

def redirect_back_or_default(default)
Spree::Deprecation.warn <<~MSG
'Please use #stored_spree_user_location_or when using solidus_auth_devise.
Otherwise, please utilize #redirect_back provided in Rails 5+ or
#redirect_back_or_to in Rails 7+ instead'
MSG

redirect_to(session["spree_user_return_to"] || default)
session["spree_user_return_to"] = nil
end
Expand All @@ -57,11 +51,6 @@ def set_guest_token
end

def store_location
Spree::Deprecation.warn <<~MSG
store_location is being deprecated in solidus 4.0
without replacement
MSG

Spree::UserLastUrlStorer.new(self).store_location
end

Expand All @@ -83,7 +72,11 @@ def try_spree_current_user
end
end

deprecate try_spree_current_user: :spree_current_user, deprecator: Spree::Deprecation
deprecate \
try_spree_current_user: :spree_current_user,
redirect_back_or_default: 'Please use `redirect_to stored_spree_user_location_or(...)` when using solidus_auth_devise.',
store_location: 'Please use `store_location_for(:spree_user, request.fullpath)` when using solidus_auth_devise.',
deprecator: Spree::Deprecation
end
end
end
Expand Down

0 comments on commit ee8cb5c

Please sign in to comment.