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:
authorSean McGivern <sean@mcgivern.me.uk>2018-01-05 17:17:19 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-01-05 17:17:19 +0300
commit0f33ac64428b06f194882e23f5167cb9791a7f0f (patch)
treed960a171a3cb5ccd7b7fe962006fdc83f659f360 /lib/api/helpers.rb
parent3489ad77c5fac13b0f3d1c94d1c0ec452453f078 (diff)
parent55980c7eca8e82e306fb3b8ade1f4a5b68a60e9f (diff)
Merge branch 'backport-issue_3413' into 'master'
[EE-backport] Add group boards API endpoint See merge request gitlab-org/gitlab-ce!16194
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 8ad4b2ecbf3..bf388163ec8 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