mirror of
https://github.com/redmine/redmine.git
synced 2026-05-13 02:57:38 +02:00
Fix RuboCop offense Rails/HttpStatus (#39889).
git-svn-id: https://svn.redmine.org/redmine/trunk@22837 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -93,7 +93,7 @@ class AttachmentsController < ApplicationController
|
||||
end
|
||||
else
|
||||
# No thumbnail for the attachment or thumbnail could not be created
|
||||
head 404
|
||||
head :not_found
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ class AttachmentsController < ApplicationController
|
||||
# Make sure that API users get used to set this content type
|
||||
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
||||
unless request.media_type == 'application/octet-stream'
|
||||
head 406
|
||||
head :not_acceptable
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -93,12 +93,12 @@ class BoardsController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to_settings_in_projects
|
||||
end
|
||||
format.js {head 200}
|
||||
format.js {head :ok}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {render :action => 'edit'}
|
||||
format.js {head 422}
|
||||
format.js {head :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,12 +70,12 @@ class CustomFieldsController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default edit_custom_field_path(@custom_field)
|
||||
end
|
||||
format.js {head 200}
|
||||
format.js {head :ok}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {render :action => 'edit'}
|
||||
format.js {head 422}
|
||||
format.js {head :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,12 +65,12 @@ class EnumerationsController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to enumerations_path
|
||||
end
|
||||
format.js {head 200}
|
||||
format.js {head :ok}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {render :action => 'edit'}
|
||||
format.js {head 422}
|
||||
format.js {head :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ class IssueRelationsController < ApplicationController
|
||||
@relations = @issue.relations
|
||||
|
||||
respond_to do |format|
|
||||
format.html {head 200}
|
||||
format.html {head :ok}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
@@ -38,7 +38,7 @@ class IssueRelationsController < ApplicationController
|
||||
raise Unauthorized unless @relation.visible?
|
||||
|
||||
respond_to do |format|
|
||||
format.html {head 200}
|
||||
format.html {head :ok}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,12 +61,12 @@ class IssueStatusesController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to issue_statuses_path(:page => params[:page])
|
||||
end
|
||||
format.js {head 200}
|
||||
format.js {head :ok}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {render :action => 'edit'}
|
||||
format.js {head 422}
|
||||
format.js {head :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,7 +84,7 @@ class IssuesController < ApplicationController
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {render :layout => !request.xhr?}
|
||||
format.any(:atom, :csv, :pdf) {head 422}
|
||||
format.any(:atom, :csv, :pdf) {head :unprocessable_entity}
|
||||
format.api {render_validation_errors(@query)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ class MailHandlerController < ActionController::Base
|
||||
def check_credential
|
||||
User.current = nil
|
||||
unless Setting.mail_handler_api_enabled? && secure_compare(params[:key].to_s, Setting.mail_handler_api_key.to_s)
|
||||
render :plain => 'Access denied. Incoming emails WS is disabled or key is invalid.', :status => 403
|
||||
render :plain => 'Access denied. Incoming emails WS is disabled or key is invalid.', :status => :forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,14 +36,14 @@ class MembersController < ApplicationController
|
||||
@members = scope.includes(:principal, :roles).order(:id).limit(@limit).offset(@offset).to_a
|
||||
|
||||
respond_to do |format|
|
||||
format.html {head 406}
|
||||
format.html {head :not_acceptable}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {head 406}
|
||||
format.html {head :not_acceptable}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
@@ -195,6 +195,6 @@ class MyController < ApplicationController
|
||||
@user = User.current
|
||||
@user.pref.order_blocks params[:group], params[:blocks]
|
||||
@user.pref.save
|
||||
head 200
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ class RepositoriesController < ApplicationController
|
||||
@entries = @repository.entries(@path, @rev)
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
if request.xhr?
|
||||
@entries ? render(:partial => 'dir_list_content') : head(200)
|
||||
@entries ? render(:partial => 'dir_list_content') : head(:ok)
|
||||
else
|
||||
(show_error_not_found; return) unless @entries
|
||||
@changesets = @repository.latest_changesets(@path, @rev)
|
||||
|
||||
@@ -85,12 +85,12 @@ class RolesController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to roles_path(:page => params[:page])
|
||||
end
|
||||
format.js {head 200}
|
||||
format.js {head :ok}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {render :action => 'edit'}
|
||||
format.js {head 422}
|
||||
format.js {head :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -90,7 +90,7 @@ class TimelogController < ApplicationController
|
||||
def show
|
||||
respond_to do |format|
|
||||
# TODO: Implement html response
|
||||
format.html {head 406}
|
||||
format.html {head :not_acceptable}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
@@ -73,7 +73,7 @@ class TrackersController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to trackers_path(:page => params[:page])
|
||||
end
|
||||
format.js {head 200}
|
||||
format.js {head :ok}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
@@ -81,7 +81,7 @@ class TrackersController < ApplicationController
|
||||
edit
|
||||
render :action => 'edit'
|
||||
end
|
||||
format.js {head 422}
|
||||
format.js {head :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ class WatchersController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to_referer_or do
|
||||
render(:html => 'Watcher added.', :status => 200, :layout => true)
|
||||
render(:html => 'Watcher added.', :status => :ok, :layout => true)
|
||||
end
|
||||
end
|
||||
format.js {@users = users_for_new_watcher}
|
||||
@@ -71,7 +71,7 @@ class WatchersController < ApplicationController
|
||||
@users = Principal.assignable_watchers.where(:id => user_ids).to_a
|
||||
end
|
||||
if @users.blank?
|
||||
head 200
|
||||
head :ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -83,7 +83,7 @@ class WatchersController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to_referer_or do
|
||||
render(:html => 'Watcher removed.', :status => 200, :layout => true)
|
||||
render(:html => 'Watcher removed.', :status => :ok, :layout => true)
|
||||
end
|
||||
end
|
||||
format.js
|
||||
@@ -132,7 +132,7 @@ class WatchersController < ApplicationController
|
||||
format.html do
|
||||
text = watching ? 'Watcher added.' : 'Watcher removed.'
|
||||
redirect_to_referer_or do
|
||||
render(:html => text, :status => 200, :layout => true)
|
||||
render(:html => text, :status => :ok, :layout => true)
|
||||
end
|
||||
end
|
||||
format.js do
|
||||
|
||||
Reference in New Issue
Block a user