diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-03-20 20:23:23 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-03-20 20:33:49 +0300 |
commit | 732f892db308863f2a2db736949c94ae9d613678 (patch) | |
tree | ebd669db3075e46f733dd348d2d95be624a586d2 /lib/api/projects.rb | |
parent | 37bd7aa6beffd1567dadcb4fff8167d050deabd8 (diff) |
Return cached languages if they've been detected before
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 8 |
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' |