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:
authorRémy Coutable <remy@rymai.me>2016-11-04 18:43:28 +0300
committerRémy Coutable <remy@rymai.me>2016-11-04 18:43:28 +0300
commitd38dd3c4ca81cdac4a3c5be4bfce930730faf99d (patch)
treee51bdd1f273b3dbff9506bfc600ff039aad0d15d /lib/api
parentd12e764744e3be11c7ed886fb454e09a4d1f57d6 (diff)
parent64e2d884d6c8d822ae6e7d4d26af054396b74921 (diff)
Merge remote-tracking branch 'origin/labels-api'
See merge request !7014 Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/labels.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/labels.rb b/lib/api/labels.rb
index 326e1e7ae00..238cea00fba 100644
--- a/lib/api/labels.rb
+++ b/lib/api/labels.rb
@@ -25,7 +25,7 @@ module API
post ':id/labels' do
authorize! :admin_label, user_project
- label = user_project.find_label(params[:name])
+ label = available_labels.find_by(title: params[:name])
conflict!('Label already exists') if label
label = user_project.labels.create(declared(params, include_parent_namespaces: false).to_h)
@@ -46,7 +46,7 @@ module API
delete ':id/labels' do
authorize! :admin_label, user_project
- label = user_project.find_label(params[:name])
+ label = user_project.labels.find_by(title: params[:name])
not_found!('Label') unless label
present label.destroy, with: Entities::Label, current_user: current_user
@@ -65,7 +65,7 @@ module API
put ':id/labels' do
authorize! :admin_label, user_project
- label = user_project.find_label(params[:name])
+ label = user_project.labels.find_by(title: params[:name])
not_found!('Label not found') unless label
update_params = declared(params,