Commit 386a0499 authored by Rémy Coutable's avatar Rémy Coutable

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
parents a7f32ae5 59154779
...@@ -247,13 +247,13 @@ class ProjectsController < Projects::ApplicationController ...@@ -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
......
---
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 ...@@ -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
......
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