diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-10-20 12:15:29 +0200 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-10-20 12:15:29 +0200 |
commit | 64e2d884d6c8d822ae6e7d4d26af054396b74921 (patch) | |
tree | b824e78b950b1d4476ebeb230c056f9e548b3ab7 /lib/api/labels.rb | |
parent | 1f949c0a6b08563f3abcd9fd4c9e750c4097b44b (diff) | |
download | gitlab-ce-64e2d884d6c8d822ae6e7d4d26af054396b74921.tar.gz |
Return conflict error in label API when title is taken by group labellabels-api
Diffstat (limited to 'lib/api/labels.rb')
-rw-r--r-- | lib/api/labels.rb | 6 |
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] |