diff options
author | Akram FARES <akramfares@gmail.com> | 2016-10-11 13:32:40 +0300 |
---|---|---|
committer | Akram Fares <akramfares@gmail.com> | 2016-11-16 00:41:40 +0300 |
commit | d54b88260c3cdedd3497c6fa9fa15e3ceedaebcb (patch) | |
tree | a7753b5892a35553e6b4549fcf08cba50d1f45c3 /app/services | |
parent | 3de1e71c8bef597034ba39992ff2753c3006439e (diff) |
Limit autocomplete to currently selected items
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/autocomplete_service.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb index 015f2828921..223461e88b6 100644 --- a/app/services/projects/autocomplete_service.rb +++ b/app/services/projects/autocomplete_service.rb @@ -13,7 +13,14 @@ module Projects end def labels - LabelsFinder.new(current_user, project_id: project.id).execute.select([:title, :color]) + LabelsFinder.new(current_user, project_id: project.id).execute. + pluck(:title, :color).map { |l| { title: l.first, color: l.second } } + end + + def unlabels(noteable) + return [] unless noteable && noteable.respond_to?(:labels) + + noteable.labels.pluck(:title, :color).map { |l| { title: l.first, color: l.second } } end def commands(noteable, type) |