Commit 25e1624d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'georgekoltsov/fix-profile-applications-page-i18n' into 'master'

Fix Profile Applications page i18n

See merge request gitlab-org/gitlab!35661
parents ea2f64cf 2ddc9575
......@@ -17,6 +17,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
before_action :add_gon_variables
before_action :load_scopes, only: [:index, :create, :edit, :update]
around_action :set_locale
helper_method :can?
layout 'profile'
......@@ -70,4 +72,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
params[:owner] = current_user
end
end
def set_locale(&block)
Gitlab::I18n.with_user_locale(current_user, &block)
end
end
---
title: Fix Profile Applications page to be shown in correct locale
merge_request: 35661
author:
type: fixed
......@@ -968,4 +968,26 @@ RSpec.describe ApplicationController do
end
end
end
describe 'locale' do
let(:user) { create(:user, preferred_language: 'uk') }
controller(described_class) do
def index
:ok
end
end
before do
sign_in(user)
allow(Gitlab::I18n).to receive(:with_locale).and_call_original
end
it "sets user's locale" do
expect(Gitlab::I18n).to receive(:with_locale).with('uk')
get :index
end
end
end
......@@ -121,6 +121,22 @@ RSpec.describe Oauth::ApplicationsController do
end
end
describe 'locale' do
let(:user) { create(:user, preferred_language: 'uk') }
before do
sign_in(user)
allow(Gitlab::I18n).to receive(:with_locale).and_call_original
end
it "sets user's locale" do
expect(Gitlab::I18n).to receive(:with_locale).with('uk')
get :new
end
end
def disable_user_oauth
allow(Gitlab::CurrentSettings.current_application_settings).to receive(:user_oauth_applications?).and_return(false)
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