OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix build with a better fix than 21b487a49d
Christophe Bliard4ffa0b16e7aa
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rbindex f51dcc911f9..a4840d225a0 100644--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb@@ -159,13 +159,12 @@ module OpenProject::TwoFactorAuthenticationpause = '<break time="500ms"/>'end- I18n.with_locale(locale_key) do- I18n.t "two_factor_authentication.text_otp_delivery_message_#{channel}",- pause:,- token: token_value,- app_title: Setting.app_title,- fallback:, raise: raise_on_missing- end+ I18n.t "two_factor_authentication.text_otp_delivery_message_#{channel}",+ pause:,+ token: token_value,+ locale: locale_key,+ app_title: Setting.app_title,+ fallback:, raise: raise_on_missingend##diff --git a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rbindex beb9ecc3d44..5520448b2c0 100644--- a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb+++ b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb@@ -44,27 +44,13 @@ describe ::OpenProject::TwoFactorAuthentication::TokenStrategy::MessageBird dolet(:locale) { 'de' }it 'returns the correct language and message' do- expect(I18n).to receive(:t)- .twice- .with('two_factor_authentication.text_otp_delivery_message_sms',- hash_including(locale: 'de'))- .and_return 'localized string'+ expected_message = I18n.t("two_factor_authentication.text_otp_delivery_message_sms",+ app_title: Setting.app_title,+ locale: 'de',+ token: '1234')- expect(subject[:language]).to eq :'de-de'- expect(subject[:message]).to eq 'localized string'- end- end-- context 'unsupported locale' do- before do- allow(user).to receive(:language).and_return 'unsupported'- # Allow I18n to receive unsupported language- allow(I18n).to receive(:enforce_available_locales!).and_call_original- allow(I18n).to receive(:enforce_available_locales!).with('unsupported')- end-- it 'falls back to english' do- expect(subject[:language]).to eq :'en-us'+ expect(subject[:language]).to be :'de-de'+ expect(subject[:message]).to eql expected_messageendendenddiff --git a/spec/support/i18n_lazy_loading.rb b/spec/support/i18n_lazy_loading.rbindex 64ea107c95c..de2d1acf7d6 100644--- a/spec/support/i18n_lazy_loading.rb+++ b/spec/support/i18n_lazy_loading.rb@@ -56,6 +56,11 @@ module I18nLazyLoadingI18nLazyLoading.load_locale(locale)superend++ def t(*args, **options)+ I18nLazyLoading.load_locale(options[:locale]) if options[:locale]+ super+ endenddef self.install