obey the dog

This commit is contained in:
Georg Gadinger 2023-01-06 10:01:14 +01:00
parent fc62e2ddb2
commit ebcf9d7676
1 changed files with 3 additions and 3 deletions

View File

@ -11,8 +11,8 @@ class ApplicationController < ActionController::Base
before_action :find_active_announcements
# check if user wants to read
def switch_locale(&action)
return I18n.with_locale("en", &action) if Rails.env.test?
def switch_locale(&) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
return I18n.with_locale("en", &) if Rails.env.test?
locale = params[:lang] || current_user&.locale || cookies[:lang] || "en"
if params[:lang] && current_user.present?
@ -22,7 +22,7 @@ class ApplicationController < ActionController::Base
cookies[:lang] = locale
I18n.with_locale(locale, &action)
I18n.with_locale(locale, &)
end
# check if user got hit by the banhammer of doom