summaryrefslogtreecommitdiff
path: root/lib/api/environments.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-07-26 14:19:37 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-07-29 13:54:45 +0200
commit76e9b68439510af5c783a81b93944f1c8d96d150 (patch)
tree62f4dde6c0caa56aa9ebbbdd31df9a215767dc87 /lib/api/environments.rb
parent84cd2120952e7ee4095cb4b5d7c959f2c11610c5 (diff)
downloadgitlab-ce-76e9b68439510af5c783a81b93944f1c8d96d150.tar.gz
Incorporate feedback
Diffstat (limited to 'lib/api/environments.rb')
-rw-r--r--lib/api/environments.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/api/environments.rb b/lib/api/environments.rb
index 66a047f72fc..532baec42c7 100644
--- a/lib/api/environments.rb
+++ b/lib/api/environments.rb
@@ -30,9 +30,6 @@ module API
required_attributes! [:name]
attrs = attributes_for_keys [:name, :external_url]
- environment = user_project.environments.find_by(name: attrs[:name])
-
- conflict!('Environment already exists') if environment
environment = user_project.environments.create(attrs)
@@ -52,7 +49,7 @@ module API
# Example Request:
# DELETE /projects/:id/environments/:environment_id
delete ':id/environments/:environment_id' do
- authorize! :admin_environment, user_project
+ authorize! :update_environment, user_project
environment = user_project.environments.find(params[:environment_id])