Commit 5cf15595 authored by Douwe Maan's avatar Douwe Maan Committed by Alejandro Rodríguez

Merge branch 'revert-0a3cafb2' into 'master'

Revert "Merge branch '22680-unlabel-limit-autocomplete-to-selected-items' into 'master'"

There were some issues with the initial implementation: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6796#note_18557076

This reverts https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6796

See merge request !7521
parent 2b3e61fa
...@@ -51,11 +51,6 @@ ...@@ -51,11 +51,6 @@
if (!GitLab.GfmAutoComplete.dataLoaded) { if (!GitLab.GfmAutoComplete.dataLoaded) {
return this.at; return this.at;
} else { } else {
if (value.indexOf("unlabel") !== -1) {
GitLab.GfmAutoComplete.input.atwho('load', '~', GitLab.GfmAutoComplete.cachedData.unlabels);
} else {
GitLab.GfmAutoComplete.input.atwho('load', '~', GitLab.GfmAutoComplete.cachedData.labels);
}
return value; return value;
} }
} }
...@@ -364,4 +359,3 @@ ...@@ -364,4 +359,3 @@
}; };
}).call(this); }).call(this);
...@@ -144,15 +144,13 @@ class ProjectsController < Projects::ApplicationController ...@@ -144,15 +144,13 @@ class ProjectsController < Projects::ApplicationController
autocomplete = ::Projects::AutocompleteService.new(@project, current_user) autocomplete = ::Projects::AutocompleteService.new(@project, current_user)
participants = ::Projects::ParticipantsService.new(@project, current_user).execute(noteable) participants = ::Projects::ParticipantsService.new(@project, current_user).execute(noteable)
unlabels = autocomplete.unlabels(noteable)
@suggestions = { @suggestions = {
emojis: Gitlab::AwardEmoji.urls, emojis: Gitlab::AwardEmoji.urls,
issues: autocomplete.issues, issues: autocomplete.issues,
milestones: autocomplete.milestones, milestones: autocomplete.milestones,
mergerequests: autocomplete.merge_requests, mergerequests: autocomplete.merge_requests,
labels: autocomplete.labels - unlabels, labels: autocomplete.labels,
unlabels: unlabels,
members: participants, members: participants,
commands: autocomplete.commands(noteable, params[:type]) commands: autocomplete.commands(noteable, params[:type])
} }
......
...@@ -13,14 +13,7 @@ module Projects ...@@ -13,14 +13,7 @@ module Projects
end end
def labels def labels
LabelsFinder.new(current_user, project_id: project.id).execute. LabelsFinder.new(current_user, project_id: project.id).execute.select([:title, :color])
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 end
def commands(noteable, type) def commands(noteable, type)
......
---
title: Limit autocomplete to currently selected items for unlabel slash command
merge_request: 22680
author: Akram Fares
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment