Commit 568a068f authored by Mark Lapierre's avatar Mark Lapierre

Merge branch '350217-merge-request-edit-language-fix' into 'master'

Add user's preferred language to cache key of MR title partial

See merge request gitlab-org/gitlab!78640
parents a39524e7 93ae17ec
......@@ -2,7 +2,7 @@
- can_update_merge_request = can?(current_user, :update_merge_request, @merge_request)
- can_reopen_merge_request = can?(current_user, :reopen_merge_request, @merge_request)
- are_close_and_open_buttons_hidden = merge_request_button_hidden?(@merge_request, true) && merge_request_button_hidden?(@merge_request, false)
- cache_key = [@project, @merge_request, can_update_merge_request, can_reopen_merge_request, are_close_and_open_buttons_hidden]
- cache_key = [@project, @merge_request, can_update_merge_request, can_reopen_merge_request, are_close_and_open_buttons_hidden, current_user&.preferred_language]
= cache(cache_key, expires_in: 1.day) do
- if @merge_request.closed_or_merged_without_fork?
......
......@@ -128,4 +128,30 @@ RSpec.describe 'User views an open merge request' do
expect(find("[data-testid='ref-name']")[:title]).to eq(source_branch)
end
end
context 'when user preferred language has changed', :use_clean_rails_memory_store_fragment_caching do
let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) }
before do
project.add_maintainer(user)
sign_in(user)
end
it 'renders edit button in preferred language' do
visit(merge_request_path(merge_request))
page.within('.detail-page-header-actions') do
expect(page).to have_link('Edit')
end
user.update!(preferred_language: 'de')
visit(merge_request_path(merge_request))
page.within('.detail-page-header-actions') do
expect(page).to have_link('Bearbeiten')
end
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