The json keys of ref switcher should not be translated
This commit is contained in:
		
							parent
							
								
									7a633e0855
								
							
						
					
					
						commit
						59154779d8
					
				|  | @ -247,13 +247,13 @@ class ProjectsController < Projects::ApplicationController | ||||||
| 
 | 
 | ||||||
|     if find_branches |     if find_branches | ||||||
|       branches = BranchesFinder.new(@repository, params).execute.take(100).map(&:name) |       branches = BranchesFinder.new(@repository, params).execute.take(100).map(&:name) | ||||||
|       options[s_('RefSwitcher|Branches')] = branches |       options['Branches'] = branches | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     if find_tags && @repository.tag_count.nonzero? |     if find_tags && @repository.tag_count.nonzero? | ||||||
|       tags = TagsFinder.new(@repository, params).execute.take(100).map(&:name) |       tags = TagsFinder.new(@repository, params).execute.take(100).map(&:name) | ||||||
| 
 | 
 | ||||||
|       options[s_('RefSwitcher|Tags')] = tags |       options['Tags'] = tags | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     # If reference is commit id - we should add it to branch/tag selectbox |     # If reference is commit id - we should add it to branch/tag selectbox | ||||||
|  |  | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | --- | ||||||
|  | title: Fix branches are not shown in Merge Request dropdown when preferred language | ||||||
|  |   is not English | ||||||
|  | merge_request: 20016 | ||||||
|  | author: Hiroyuki Sato | ||||||
|  | type: fixed | ||||||
|  | @ -597,6 +597,22 @@ describe ProjectsController do | ||||||
|       expect(parsed_body["Tags"]).to include("v1.0.0") |       expect(parsed_body["Tags"]).to include("v1.0.0") | ||||||
|       expect(parsed_body["Commits"]).to include("123456") |       expect(parsed_body["Commits"]).to include("123456") | ||||||
|     end |     end | ||||||
|  | 
 | ||||||
|  |     context "when preferred language is Japanese" do | ||||||
|  |       before do | ||||||
|  |         user.update!(preferred_language: 'ja') | ||||||
|  |         sign_in(user) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       it "gets a list of branches, tags and commits" do | ||||||
|  |         get :refs, namespace_id: public_project.namespace, id: public_project, ref: "123456" | ||||||
|  | 
 | ||||||
|  |         parsed_body = JSON.parse(response.body) | ||||||
|  |         expect(parsed_body["Branches"]).to include("master") | ||||||
|  |         expect(parsed_body["Tags"]).to include("v1.0.0") | ||||||
|  |         expect(parsed_body["Commits"]).to include("123456") | ||||||
|  |       end | ||||||
|  |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   describe 'POST #preview_markdown' do |   describe 'POST #preview_markdown' do | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue