summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-04-02 07:48:28 +0000
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-04-02 07:48:28 +0000
commitb122be5ed55e3898196fb21e47fff40eb7dd6e0c (patch)
tree709d2763de4f693086b1f0cbe8848df3a8ed5509 /lib/api
parent02dcecdb5f51f6988ede356d0d245d6cd7745520 (diff)
parent732f892db308863f2a2db736949c94ae9d613678 (diff)
downloadgitlab-ce-b122be5ed55e3898196fb21e47fff40eb7dd6e0c.tar.gz
Merge branch 'security-id-potential-denial-languages' into 'master'
Return cached languages if they've been detected before See merge request gitlab/gitlabhq!2998
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/projects.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 91501ba4d36..22c90e4e83e 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -392,11 +392,9 @@ module API
desc 'Get languages in project repository'
get ':id/languages' do
- 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
+ ::Projects::RepositoryLanguagesService
+ .new(user_project, current_user)
+ .execute.map { |lang| [lang.name, lang.share] }.to_h
end
desc 'Remove a project'