Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2017-12-06 22:07:47 +0300
committerFelipe Artur <felipefac@gmail.com>2018-01-04 22:28:10 +0300
commit5e148d4e931792733400f59864e1aa886ef55953 (patch)
tree3e08b1776015895dcb242909df01f5db60265d7e /lib/api/helpers.rb
parente5a9b9a14d32d890dea20403c977dfd569eb3e17 (diff)
EE-BACKPORT group boards
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 9ba15893f55..c1f5ec2ab14 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -74,8 +74,15 @@ module API
page || not_found!('Wiki Page')
end
- def available_labels
- @available_labels ||= LabelsFinder.new(current_user, project_id: user_project.id).execute
+ def available_labels_for(label_parent)
+ search_params =
+ if label_parent.is_a?(Project)
+ { project_id: label_parent.id }
+ else
+ { group_id: label_parent.id, only_group_labels: true }
+ end
+
+ LabelsFinder.new(current_user, search_params).execute
end
def find_user(id)
@@ -141,7 +148,9 @@ module API
end
def find_project_label(id)
- label = available_labels.find_by_id(id) || available_labels.find_by_title(id)
+ labels = available_labels_for(user_project)
+ label = labels.find_by_id(id) || labels.find_by_title(id)
+
label || not_found!('Label')
end