Commit 82664385 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'refactor/user_default_preferred_language' into 'master'

Refactor user default preferred_language

See merge request gitlab-org/gitlab!71125
parents 373a13b2 94a4abc9
......@@ -455,7 +455,7 @@ class User < ApplicationRecord
def preferred_language
read_attribute('preferred_language') ||
I18n.default_locale.to_s.presence_in(Gitlab::I18n.available_locales) ||
'en'
default_preferred_language
end
def active_for_authentication?
......@@ -2004,6 +2004,11 @@ class User < ApplicationRecord
private
# To enable JiHu repository to modify the default language options
def default_preferred_language
'en'
end
def notification_email_verified
return if notification_email.blank? || temp_oauth_email?
......
......@@ -343,8 +343,9 @@ RSpec.describe User do
it 'falls back to english when I18n.default_locale is not an available language' do
I18n.default_locale = :kl
default_preferred_language = user.send(:default_preferred_language)
expect(user.preferred_language).to eq 'en'
expect(user.preferred_language).to eq default_preferred_language
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment