Skip to content

Commit

Permalink
Stop using try_spree_current_user
Browse files Browse the repository at this point in the history
The current gem is defining `spree_current_user` so we don't need to
be defensive about using it directly.

Related to solidusio/solidus#3923.
  • Loading branch information
elia committed Jun 30, 2022
1 parent 9023710 commit 9597190
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
original "904c52ff702412d1dc8d55ff44d87d7f581f6675"
-->

<% if @user != try_spree_current_user %>
<% if @user != spree_current_user %>
<fieldset class="no-border-bottom" data-hook="admin_user_reset_password">
<legend><%= t(:'spree.forgot_password') %></legend>

Expand Down
4 changes: 2 additions & 2 deletions lib/spree/auth/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def self.redirect_back_on_unauthorized?

def self.prepare_backend
Spree::Admin::BaseController.unauthorized_redirect = -> do
if try_spree_current_user
if spree_current_user
flash[:error] = I18n.t('spree.authorization_failure')

if Spree::Auth::Engine.redirect_back_on_unauthorized?
Expand All @@ -71,7 +71,7 @@ def self.prepare_backend

def self.prepare_frontend
Spree::BaseController.unauthorized_redirect = -> do
if try_spree_current_user
if spree_current_user
flash[:error] = I18n.t('spree.authorization_failure')

if Spree::Auth::Engine.redirect_back_on_unauthorized?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<% if spree_current_user %>
<ul id="login-nav" class="admin-login-nav">
<li data-hook="user-account-link">
<% if can?(:admin, try_spree_current_user) %>
<%= link_to spree.edit_admin_user_path(try_spree_current_user) do %>
<% if can?(:admin, spree_current_user) %>
<%= link_to spree.edit_admin_user_path(spree_current_user) do %>
<i class='fa fa-user'></i>
<%= try_spree_current_user.email %>
<%= spree_current_user.email %>
<% end %>
<% else %>
<a>
<i class='fa fa-user'></i>
<%= try_spree_current_user.email %>
<%= spree_current_user.email %>
</a>
<% end %>
</li>
Expand Down

0 comments on commit 9597190

Please sign in to comment.