Skip to content

Commit

Permalink
Fix inconsistence between the locale on the backend and the locale in…
Browse files Browse the repository at this point in the history
… the devise's backend controllers

NOTE: ::Spree::Admin::SetsUserLanguageLocaleKey concern added in Solidus 3.2, so as soon as this gem stops supporting Solidus versions < 3.2 this "if" should be replaced with simple include
  • Loading branch information
bitberry-dev committed Aug 24, 2022
1 parent 094e93e commit 2a6ca76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/controllers/backend/spree/admin/user_passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,15 @@ def update
super
end
end

private

# NOTE: as soon as this gem stops supporting Solidus 3.1 if-else should be removed and left only include
if defined?(::Spree::Admin::SetsUserLanguageLocaleKey)
include ::Spree::Admin::SetsUserLanguageLocaleKey
else
def set_user_language_locale_key
:admin_locale
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def authorization_failure

private

# NOTE: as soon as this gem stops supporting Solidus 3.1 if-else should be removed and left only include
if defined?(::Spree::Admin::SetsUserLanguageLocaleKey)
include ::Spree::Admin::SetsUserLanguageLocaleKey
else
def set_user_language_locale_key
:admin_locale
end
end

def accurate_title
I18n.t('spree.login')
end
Expand Down

0 comments on commit 2a6ca76

Please sign in to comment.