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
path: root/lib/api
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2019-01-03 17:07:13 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2019-01-31 15:49:51 +0300
commit4e9aa7e2c042030cea190a1e57dee76de0e573ea (patch)
tree84e17993ce8a89a5b9554e133cba186f84082cf7 /lib/api
parent22d2a48006176ffd87ef82b75340a38cf60adefe (diff)
Correctly search for labels in parent groups
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/group_labels.rb4
-rw-r--r--lib/api/helpers.rb8
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/group_labels.rb b/lib/api/group_labels.rb
index e3c4033c508..85fd470c10d 100644
--- a/lib/api/group_labels.rb
+++ b/lib/api/group_labels.rb
@@ -57,7 +57,7 @@ module API
delete ':id/labels' do
authorize! :admin_label, user_group
- label = find_label(user_group, params[:name])
+ label = find_label(user_group, params[:name], false)
destroy_conditionally!(label)
end
@@ -76,7 +76,7 @@ module API
put ':id/labels' do
authorize! :admin_label, user_group
- label = find_label(user_group, params[:name])
+ label = find_label(user_group, params[:name], false)
label = ::Labels::UpdateService.new(declared_params(include_missing: false)).execute(label)
render_validation_error!(label) unless label.valid?
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index ccfadef2736..afe0437c555 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -84,8 +84,8 @@ module API
page || not_found!('Wiki Page')
end
- def available_labels_for(label_parent, search_params = {})
- search_params.merge(include_ancestor_groups: true)
+ def available_labels_for(label_parent, include_ancestor_groups = true)
+ search_params = { include_ancestor_groups: include_ancestor_groups }
if label_parent.is_a?(Project)
search_params[:project_id] = label_parent.id
@@ -170,8 +170,8 @@ module API
end
end
- def find_label(parent, id)
- labels = available_labels_for(parent)
+ def find_label(parent, id, include_ancestor_groups = true)
+ labels = available_labels_for(parent, include_ancestor_groups)
label = labels.find_by_id(id) || labels.find_by_title(id)
label || not_found!('Label')