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:
authorDouwe Maan <douwe@selenight.nl>2016-10-20 13:15:29 +0300
committerDouwe Maan <douwe@selenight.nl>2016-10-20 13:15:29 +0300
commit64e2d884d6c8d822ae6e7d4d26af054396b74921 (patch)
treeb824e78b950b1d4476ebeb230c056f9e548b3ab7 /lib/api/labels.rb
parent1f949c0a6b08563f3abcd9fd4c9e750c4097b44b (diff)
Return conflict error in label API when title is taken by group label
Diffstat (limited to 'lib/api/labels.rb')
-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 642e6345b9e..40d7f4a5151 100644
--- a/lib/api/labels.rb
+++ b/lib/api/labels.rb
@@ -29,8 +29,8 @@ module API
required_attributes! [:name, :color]
attrs = attributes_for_keys [:name, :color, :description]
- label = user_project.find_label(attrs[:name])
+ label = available_labels.find_by(title: attrs[:name])
conflict!('Label already exists') if label
label = user_project.labels.create(attrs)
@@ -54,7 +54,7 @@ module API
authorize! :admin_label, user_project
required_attributes! [:name]
- label = user_project.find_label(params[:name])
+ label = user_project.labels.find_by(title: params[:name])
not_found!('Label') unless label
label.destroy
@@ -75,7 +75,7 @@ module API
authorize! :admin_label, user_project
required_attributes! [:name]
- label = user_project.find_label(params[:name])
+ label = user_project.labels.find_by(title: params[:name])
not_found!('Label not found') unless label
attrs = attributes_for_keys [:new_name, :color, :description]