diff options
author | Nick Thomas <nick@gitlab.com> | 2019-02-25 19:41:04 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-02-25 19:41:04 +0300 |
commit | 0b0a04fdf7ba31975407daa978f6f8f7c2f8bb3e (patch) | |
tree | 04b55a37cd1083728677208b3bc73bad98c0d067 /lib/api/projects.rb | |
parent | d63f3ea7da1fefbb9374b0b4b077f08b8a44d2f6 (diff) | |
parent | abe8cbe90b06f4355b6a783eb22bf46154569ec5 (diff) |
Merge branch 'zj-load-languages-from-database' into 'master'
Load repository language from the DB if detected
Closes #47390
See merge request gitlab-org/gitlab-ce!25518
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index bd5678f513f..b23fe6cd4e7 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -388,7 +388,11 @@ module API desc 'Get languages in project repository' get ':id/languages' do - user_project.repository.languages.map { |language| language.values_at(:label, :value) }.to_h + if user_project.repository_languages.present? + user_project.repository_languages.map { |l| [l.name, l.share] }.to_h + else + user_project.repository.languages.map { |language| language.values_at(:label, :value) }.to_h + end end desc 'Remove a project' |