From: Jean-Philippe Lang Date: Sun, 17 Jul 2016 06:35:28 +0000 (+0000) Subject: Use head instead of render :nothing => true. X-Git-Tag: 3.4.0~776 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cad0036297bdecc13bcd5cb66f439081ca2bae9f;p=redmine.git Use head instead of render :nothing => true. git-svn-id: http://svn.redmine.org/redmine/trunk@15687 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index de61e8412..7387809bf 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -73,7 +73,7 @@ class AttachmentsController < ApplicationController end else # No thumbnail for the attachment or thumbnail could not be created - render :nothing => true, :status => 404 + head 404 end end @@ -81,7 +81,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.content_type == 'application/octet-stream' - render :nothing => true, :status => 406 + head 406 return end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 35e779370..df90f0db4 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -91,12 +91,12 @@ class BoardsController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to_settings_in_projects } - format.js { render :nothing => true } + format.js { head 200 } end else respond_to do |format| format.html { render :action => 'edit' } - format.js { render :nothing => true, :status => 422 } + format.js { head 422 } end end end diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index c0b4ac9e9..230df1853 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -60,12 +60,12 @@ class CustomFieldsController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_back_or_default edit_custom_field_path(@custom_field) } - format.js { render :nothing => true } + format.js { head 200 } end else respond_to do |format| format.html { render :action => 'edit' } - format.js { render :nothing => true, :status => 422 } + format.js { head 422 } end end end diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 905c67dda..e3ae66986 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -62,12 +62,12 @@ class EnumerationsController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to enumerations_path } - format.js { render :nothing => true } + format.js { head 200 } end else respond_to do |format| format.html { render :action => 'edit' } - format.js { render :nothing => true, :status => 422 } + format.js { head 422 } end end end diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb index 70ec5b4a5..9c8c2fe1d 100644 --- a/app/controllers/issue_relations_controller.rb +++ b/app/controllers/issue_relations_controller.rb @@ -25,7 +25,7 @@ class IssueRelationsController < ApplicationController @relations = @issue.relations respond_to do |format| - format.html { render :nothing => true } + format.html { head 200 } format.api end end @@ -34,7 +34,7 @@ class IssueRelationsController < ApplicationController raise Unauthorized unless @relation.visible? respond_to do |format| - format.html { render :nothing => true } + format.html { head 200 } format.api end end diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index cac8c971e..8ae945c18 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -56,12 +56,12 @@ class IssueStatusesController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to issue_statuses_path(:page => params[:page]) } - format.js { render :nothing => true } + format.js { head 200 } end else respond_to do |format| format.html { render :action => 'edit' } - format.js { render :nothing => true, :status => 422 } + format.js { head 422 } end end end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 85b2c23a9..05fb064cd 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -84,7 +84,7 @@ class IssuesController < ApplicationController else respond_to do |format| format.html { render(:template => 'issues/index', :layout => !request.xhr?) } - format.any(:atom, :csv, :pdf) { render(:nothing => true) } + format.any(:atom, :csv, :pdf) { head 422 } format.api { render_validation_errors(@query) } end end diff --git a/app/controllers/mail_handler_controller.rb b/app/controllers/mail_handler_controller.rb index 4949cc2d5..1b7cddfac 100644 --- a/app/controllers/mail_handler_controller.rb +++ b/app/controllers/mail_handler_controller.rb @@ -27,9 +27,9 @@ class MailHandlerController < ActionController::Base options = params.dup email = options.delete(:email) if MailHandler.receive(email, options) - render :nothing => true, :status => :created + head :created else - render :nothing => true, :status => :unprocessable_entity + head :unprocessable_entity end end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index aefb30282..6597fb245 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -206,6 +206,6 @@ class MyController < ApplicationController @user.pref.save end end - render :nothing => true + head 200 end end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index abb1aabdb..9bee5b837 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -116,7 +116,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') : render(:nothing => true) + @entries ? render(:partial => 'dir_list_content') : head(200) else (show_error_not_found; return) unless @entries @changesets = @repository.latest_changesets(@path, @rev) diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index a5bb02e0f..c33eff578 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -80,12 +80,12 @@ class RolesController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to roles_path(:page => params[:page]) } - format.js { render :nothing => true } + format.js { head 200 } end else respond_to do |format| format.html { render :action => 'edit' } - format.js { render :nothing => true, :status => 422 } + format.js { head 422 } end end end diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb index 495cbcf64..87b489d3a 100644 --- a/app/controllers/sys_controller.rb +++ b/app/controllers/sys_controller.rb @@ -31,7 +31,7 @@ class SysController < ActionController::Base def create_project_repository project = Project.find(params[:id]) if project.repository - render :nothing => true, :status => 409 + head 409 else logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}." repository = Repository.factory(params[:vendor], params[:repository]) @@ -39,7 +39,7 @@ class SysController < ActionController::Base if repository.save render :xml => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201 else - render :nothing => true, :status => 422 + head 422 end end end @@ -64,9 +64,9 @@ class SysController < ActionController::Base repository.fetch_changesets end end - render :nothing => true, :status => 200 + head 200 rescue ActiveRecord::RecordNotFound - render :nothing => true, :status => 404 + head 404 end protected diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index f293855a5..2c72f49c6 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -88,7 +88,7 @@ class TimelogController < ApplicationController def show respond_to do |format| # TODO: Implement html response - format.html { render :nothing => true, :status => 406 } + format.html { head 406 } format.api end end diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 72dbdaf7c..363bd40d8 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -67,7 +67,7 @@ class TrackersController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to trackers_path(:page => params[:page]) } - format.js { render :nothing => true } + format.js { head 200 } end else respond_to do |format| @@ -75,7 +75,7 @@ class TrackersController < ApplicationController edit render :action => 'edit' } - format.js { render :nothing => true, :status => 422 } + format.js { head 422 } end end end