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:
authorRobert Schilling <rschilling@student.tugraz.at>2016-11-14 16:44:27 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2016-11-14 17:22:06 +0300
commit76bd09326fe070d4c865b6fbc1718673d096c178 (patch)
tree51cdbf23ce1e1beeebc84b9e95a5b8f9eeb6ac66 /lib/api/labels.rb
parent36fa5d660df96c49484cd27695da1df6e361eb8f (diff)
Use declared_params helper in API
Diffstat (limited to 'lib/api/labels.rb')
-rw-r--r--lib/api/labels.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/api/labels.rb b/lib/api/labels.rb
index 97218054f37..652786d4e3e 100644
--- a/lib/api/labels.rb
+++ b/lib/api/labels.rb
@@ -30,10 +30,7 @@ module API
conflict!('Label already exists') if label
priority = params.delete(:priority)
- label_params = declared(params,
- include_parent_namespaces: false,
- include_missing: false).to_h
- label = user_project.labels.create(label_params)
+ label = user_project.labels.create(declared_params(include_missing: false))
if label.valid?
label.prioritize!(user_project, priority) if priority
@@ -77,11 +74,9 @@ module API
update_priority = params.key?(:priority)
priority = params.delete(:priority)
- label_params = declared(params,
- include_parent_namespaces: false,
- include_missing: false).to_h
+ label_params = declared_params(include_missing: false)
# Rename new name to the actual label attribute name
- label_params[:name] = label_params.delete('new_name') if label_params.key?('new_name')
+ label_params[:name] = label_params.delete(:new_name) if label_params.key?(:new_name)
render_validation_error!(label) unless label.update(label_params)