]> source.dussan.org Git - redmine.git/commitdiff
Use head instead of render :nothing => true.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 17 Jul 2016 06:35:28 +0000 (06:35 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 17 Jul 2016 06:35:28 +0000 (06:35 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15687 e93f8b46-1217-0410-a6f0-8f06a7374b81

14 files changed:
app/controllers/attachments_controller.rb
app/controllers/boards_controller.rb
app/controllers/custom_fields_controller.rb
app/controllers/enumerations_controller.rb
app/controllers/issue_relations_controller.rb
app/controllers/issue_statuses_controller.rb
app/controllers/issues_controller.rb
app/controllers/mail_handler_controller.rb
app/controllers/my_controller.rb
app/controllers/repositories_controller.rb
app/controllers/roles_controller.rb
app/controllers/sys_controller.rb
app/controllers/timelog_controller.rb
app/controllers/trackers_controller.rb

index de61e841218ec4a905bd9d459f0e0736c076480a..7387809bf43f9825601df47b4b36442c2e5020ba 100644 (file)
@@ -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
 
index 35e779370c6f4e668f5e6022643fe89137e63967..df90f0db417e604b8599589272e4cd5b0bd22599 100644 (file)
@@ -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
index c0b4ac9e9138aa2207fda3a3cb20c75cf572321a..230df1853a65d0a59324dd62a6c9469d362fe3ce 100644 (file)
@@ -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
index 905c67dda9bcda665054ce5d6be6ead7de689e7f..e3ae6698677bfa84ca5c67d6cb8da87250685b66 100644 (file)
@@ -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
index 70ec5b4a5b1c06fc5cd44b52f4064758c14551f0..9c8c2fe1d940f86acfe32e0b935b981db0e57da9 100644 (file)
@@ -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
index cac8c971ed2aae71d6af0787f4100caa853e7e74..8ae945c18e2026a3a45c1ee0b0dac371fc43220a 100644 (file)
@@ -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
index 85b2c23a99f542f566b8bbe49c273ad33665639d..05fb064cd6757261e0ca4ad9279e1c8a6f9eec5e 100644 (file)
@@ -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
index 4949cc2d5d5597f87cf2094cdc93240d29052af3..1b7cddfac00b8e109ef7343533d62e4bef898162 100644 (file)
@@ -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
 
index aefb30282ae1e7c7ec194ee4eb282d36fddf7685..6597fb245fec2666b2f1311c02f5f99fc5368320 100644 (file)
@@ -206,6 +206,6 @@ class MyController < ApplicationController
         @user.pref.save
       end
     end
-    render :nothing => true
+    head 200
   end
 end
index abb1aabdb4916542b92aab91df6640f63f5a38a9..9bee5b8371c68c4eba06480a8c6d83a37391662e 100644 (file)
@@ -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)
index a5bb02e0fdb39ffd5c3279778233340e8d8a6262..c33eff57830b10b5f49988ab591d10285f1febdd 100644 (file)
@@ -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
index 495cbcf64acbc285fc592c1861d503d926200ea9..87b489d3a11d2db9da3514d1b2001f0e149d28f5 100644 (file)
@@ -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
index f293855a594d858c6e68c7b1071c862de39283ea..2c72f49c6019f5377c2d0c3b7ffd4d3052eca450 100644 (file)
@@ -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
index 72dbdaf7c719acf99313f7caee00647b685b8e81..363bd40d8fe5321e932869f91869f973593b12c2 100644 (file)
@@ -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