Browse Source

Use head instead of render :nothing => true.

git-svn-id: http://svn.redmine.org/redmine/trunk@15687 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.4.0
Jean-Philippe Lang 7 years ago
parent
commit
cad0036297

+ 2
- 2
app/controllers/attachments_controller.rb View 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


+ 2
- 2
app/controllers/boards_controller.rb View 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

+ 2
- 2
app/controllers/custom_fields_controller.rb View 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

+ 2
- 2
app/controllers/enumerations_controller.rb View 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

+ 2
- 2
app/controllers/issue_relations_controller.rb View 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

+ 2
- 2
app/controllers/issue_statuses_controller.rb View 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

+ 1
- 1
app/controllers/issues_controller.rb View 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

+ 2
- 2
app/controllers/mail_handler_controller.rb View 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


+ 1
- 1
app/controllers/my_controller.rb View File

@@ -206,6 +206,6 @@ class MyController < ApplicationController
@user.pref.save
end
end
render :nothing => true
head 200
end
end

+ 1
- 1
app/controllers/repositories_controller.rb View 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)

+ 2
- 2
app/controllers/roles_controller.rb View 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

+ 4
- 4
app/controllers/sys_controller.rb View 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

+ 1
- 1
app/controllers/timelog_controller.rb View 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

+ 2
- 2
app/controllers/trackers_controller.rb View 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

Loading…
Cancel
Save