diff options
author | Go MAEDA <maeda@farend.jp> | 2024-05-18 05:56:55 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-05-18 05:56:55 +0000 |
commit | a9518e28b86a330cbbc2cd2c9170e1cd38c458e2 (patch) | |
tree | 0a89a098bd85c03c1eeadfd29beb72683afa30a1 /app/controllers/sys_controller.rb | |
parent | 58e9cd420adad1802d42828c8efedca0e6fed2d1 (diff) | |
download | redmine-a9518e28b86a330cbbc2cd2c9170e1cd38c458e2.tar.gz redmine-a9518e28b86a330cbbc2cd2c9170e1cd38c458e2.zip |
Fix RuboCop offense Rails/HttpStatus (#39889).
git-svn-id: https://svn.redmine.org/redmine/trunk@22837 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/sys_controller.rb')
-rw-r--r-- | app/controllers/sys_controller.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb index f5e333554..7e785f951 100644 --- a/app/controllers/sys_controller.rb +++ b/app/controllers/sys_controller.rb @@ -37,16 +37,16 @@ class SysController < ActionController::Base def create_project_repository project = Project.find(params[:id]) if project.repository - head 409 + head :conflict else logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}." repository = Repository.factory(params[:vendor]) repository.safe_attributes = params[:repository] repository.project = project if repository.save - render :json => {repository.class.name.underscore.tr('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201 + render :json => {repository.class.name.underscore.tr('/', '-') => {:id => repository.id, :url => repository.url}}, :status => :created else - head 422 + head :unprocessable_entity end end end @@ -72,9 +72,9 @@ class SysController < ActionController::Base repository.fetch_changesets end end - head 200 + head :ok rescue ActiveRecord::RecordNotFound - head 404 + head :not_found end protected @@ -82,7 +82,7 @@ class SysController < ActionController::Base def check_enabled User.current = nil unless Setting.sys_api_enabled? && secure_compare(params[:key].to_s, Setting.sys_api_key.to_s) - render :plain => 'Access denied. Repository management WS is disabled or key is invalid.', :status => 403 + render :plain => 'Access denied. Repository management WS is disabled or key is invalid.', :status => :forbidden return false end end |