summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-11-17 10:45:31 +0000
committerAlejandro Rodríguez <alejorro70@gmail.com>2016-11-18 21:47:16 +0000
commit5cf15595e848cd3ffce585ceb5b4993de1b9dbcf (patch)
tree746c59dff1b2c2c49dc86f225abb9e195f486e5e
parent2b3e61fa74d2ca8c1d5c54a3e324c33377fd3515 (diff)
downloadgitlab-ce-5cf15595e848cd3ffce585ceb5b4993de1b9dbcf.tar.gz
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
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js.es66
-rw-r--r--app/controllers/projects_controller.rb4
-rw-r--r--app/services/projects/autocomplete_service.rb9
-rw-r--r--changelogs/unreleased/22680-unlabel-limit-autocomplete-to-selected-items.yml4
4 files changed, 2 insertions, 21 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6
index 410ae6c0f3a..5d9ac4d350a 100644
--- a/app/assets/javascripts/gfm_auto_complete.js.es6
+++ b/app/assets/javascripts/gfm_auto_complete.js.es6
@@ -51,11 +51,6 @@
if (!GitLab.GfmAutoComplete.dataLoaded) {
return this.at;
} 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;
}
}
@@ -364,4 +359,3 @@
};
}).call(this);
-
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 7376c2bfeb7..a8a18b4fa16 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -144,15 +144,13 @@ class ProjectsController < Projects::ApplicationController
autocomplete = ::Projects::AutocompleteService.new(@project, current_user)
participants = ::Projects::ParticipantsService.new(@project, current_user).execute(noteable)
- unlabels = autocomplete.unlabels(noteable)
@suggestions = {
emojis: Gitlab::AwardEmoji.urls,
issues: autocomplete.issues,
milestones: autocomplete.milestones,
mergerequests: autocomplete.merge_requests,
- labels: autocomplete.labels - unlabels,
- unlabels: unlabels,
+ labels: autocomplete.labels,
members: participants,
commands: autocomplete.commands(noteable, params[:type])
}
diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb
index 223461e88b6..015f2828921 100644
--- a/app/services/projects/autocomplete_service.rb
+++ b/app/services/projects/autocomplete_service.rb
@@ -13,14 +13,7 @@ module Projects
end
def labels
- 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 } }
+ LabelsFinder.new(current_user, project_id: project.id).execute.select([:title, :color])
end
def commands(noteable, type)
diff --git a/changelogs/unreleased/22680-unlabel-limit-autocomplete-to-selected-items.yml b/changelogs/unreleased/22680-unlabel-limit-autocomplete-to-selected-items.yml
deleted file mode 100644
index 95fd07c12e1..00000000000
--- a/changelogs/unreleased/22680-unlabel-limit-autocomplete-to-selected-items.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Limit autocomplete to currently selected items for unlabel slash command
-merge_request: 22680
-author: Akram Fares