Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/app/models/spree/user_last_url_storer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def self.rules
# or its subclasses. The controller will be passed to each rule for matching.
def initialize(controller)
@controller = controller
Spree::Deprecation.warn("This class will be removed without replacement on the release of Solidus 4.0")
Spree::Deprecation.warn("#{self.class} will be removed without replacement on the release of Solidus 4.0")
end

# Stores into session[:spree_user_return_to] the request full path for
Expand Down
29 changes: 11 additions & 18 deletions core/lib/spree/core/controller_helpers/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,20 @@ 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

def set_guest_token
unless cookies.signed[:guest_token].present?
cookies.permanent.signed[:guest_token] = Spree::Config[:guest_token_cookie_options].merge(
value: SecureRandom.urlsafe_base64(nil, false),
httponly: true
)
end
return if cookies.signed[:guest_token].present?

cookies.permanent.signed[:guest_token] = Spree::Config[:guest_token_cookie_options].merge(
value: SecureRandom.urlsafe_base64(nil, false),
httponly: true
)
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