diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-16 14:11:53 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-16 14:11:53 +0300 |
commit | 0a3cafb2895bef3577e2b9ca09c4eb8bdb8565fa (patch) | |
tree | 884ffdb3cf585154a245de36216a60939ee310cb /app/services | |
parent | b33791d8b94f5b41699996414e7fa2ce06e2f519 (diff) | |
parent | d54b88260c3cdedd3497c6fa9fa15e3ceedaebcb (diff) |
Merge branch '22680-unlabel-limit-autocomplete-to-selected-items' into 'master'
Limit autocomplete to currently selected items
When using the /unlabel command the autocomplete list of labels is now
limited to the list of labels currently assigned to the issue.
Closes #22680
See merge request !6796
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) |