Merge branch '48100-fix-branch-not-shown' into 'master'

Resolve "Set the language setting to something other than English, the branch of Merge Request will not be visible."

Closes #48100

See merge request gitlab-org/gitlab-ce!20016
This commit is contained in:
Rémy Coutable 2018-06-20 11:45:12 +00:00
commit 386a049997
3 changed files with 24 additions and 2 deletions

View File

@ -247,13 +247,13 @@ class ProjectsController < Projects::ApplicationController
if find_branches
branches = BranchesFinder.new(@repository, params).execute.take(100).map(&:name)
options[s_('RefSwitcher|Branches')] = branches
options['Branches'] = branches
end
if find_tags && @repository.tag_count.nonzero?
tags = TagsFinder.new(@repository, params).execute.take(100).map(&:name)
options[s_('RefSwitcher|Tags')] = tags
options['Tags'] = tags
end
# If reference is commit id - we should add it to branch/tag selectbox

View File

@ -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

View File

@ -597,6 +597,22 @@ describe ProjectsController do
expect(parsed_body["Tags"]).to include("v1.0.0")
expect(parsed_body["Commits"]).to include("123456")
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
describe 'POST #preview_markdown' do