Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize Devise Location helpers #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cpfergus1
Copy link

@cpfergus1 cpfergus1 commented Sep 13, 2022

Description
Removes #redirect_back_or_default in favor of solidus_auth_devise helper methods

Motivation and Context
The method #redirect_back_or_default and the class user_last_url_storer will be deprecated in Solidus solidusio/solidus#4533 which would break the current build without these changes. SolidusAuthDevise has similar a helper method to #redirect_back_or_default, #stored_spree_user_location_or which was introduced in solidusio/solidus_auth_devise#228 and will be utilized instead.

How Has This Been Tested?
The current test suite covers the changes made in the PR

@@ -21,7 +21,7 @@ def provides_callback_for(*providers)
def omniauth_callback
if request.env['omniauth.error'].present?
flash[:error] = I18n.t('devise.omniauth_callbacks.failure', kind: auth_hash['provider'], reason: I18n.t('spree.user_was_not_valid'))
redirect_back_or_default(root_url)
redirect_to stored_spree_user_location_or(root_url)
Copy link
Member

@kennyadsl kennyadsl Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes we are using the latest version of solidus_auth_devise, which contains the solidusio/solidus_auth_devise#228 and it's not always true. We should probably make it conditional, isn't it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always be using the latest solidus_auth_devise as the version number is not specified in the gemspec and it should resolve to the latest I would expect. It is true this would break if the user specified solidus_auth_devise 2.5.4, but I feel like we may want to specify in the gemspec rather than create a conditional here. WDYT?

With the deprecation of #redirect_back_or_default in solidus 4.0,
we can utilize the SolidusAuthDevise helper stored_location_for
to provide the same functionality.
@cpfergus1 cpfergus1 force-pushed the nebulab/remove-redirect-back-or-default branch from 31ed644 to aa75c33 Compare September 19, 2022 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants