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 8 years ago
parent
commit
cad0036297

+ 2
- 2
app/controllers/attachments_controller.rb View File

end end
else else
# No thumbnail for the attachment or thumbnail could not be created # No thumbnail for the attachment or thumbnail could not be created
render :nothing => true, :status => 404
head 404
end end
end end


# Make sure that API users get used to set this content type # 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 # as it won't trigger Rails' automatic parsing of the request body for parameters
unless request.content_type == 'application/octet-stream' unless request.content_type == 'application/octet-stream'
render :nothing => true, :status => 406
head 406
return return
end end



+ 2
- 2
app/controllers/boards_controller.rb View File

flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to_settings_in_projects redirect_to_settings_in_projects
} }
format.js { render :nothing => true }
format.js { head 200 }
end end
else else
respond_to do |format| respond_to do |format|
format.html { render :action => 'edit' } format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
format.js { head 422 }
end end
end end
end end

+ 2
- 2
app/controllers/custom_fields_controller.rb View File

flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_back_or_default edit_custom_field_path(@custom_field) redirect_back_or_default edit_custom_field_path(@custom_field)
} }
format.js { render :nothing => true }
format.js { head 200 }
end end
else else
respond_to do |format| respond_to do |format|
format.html { render :action => 'edit' } format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
format.js { head 422 }
end end
end end
end end

+ 2
- 2
app/controllers/enumerations_controller.rb View File

flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to enumerations_path redirect_to enumerations_path
} }
format.js { render :nothing => true }
format.js { head 200 }
end end
else else
respond_to do |format| respond_to do |format|
format.html { render :action => 'edit' } format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
format.js { head 422 }
end end
end end
end end

+ 2
- 2
app/controllers/issue_relations_controller.rb View File

@relations = @issue.relations @relations = @issue.relations


respond_to do |format| respond_to do |format|
format.html { render :nothing => true }
format.html { head 200 }
format.api format.api
end end
end end
raise Unauthorized unless @relation.visible? raise Unauthorized unless @relation.visible?


respond_to do |format| respond_to do |format|
format.html { render :nothing => true }
format.html { head 200 }
format.api format.api
end end
end end

+ 2
- 2
app/controllers/issue_statuses_controller.rb View File

flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to issue_statuses_path(:page => params[:page]) redirect_to issue_statuses_path(:page => params[:page])
} }
format.js { render :nothing => true }
format.js { head 200 }
end end
else else
respond_to do |format| respond_to do |format|
format.html { render :action => 'edit' } format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
format.js { head 422 }
end end
end end
end end

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

else else
respond_to do |format| respond_to do |format|
format.html { render(:template => 'issues/index', :layout => !request.xhr?) } 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) } format.api { render_validation_errors(@query) }
end end
end end

+ 2
- 2
app/controllers/mail_handler_controller.rb View File

options = params.dup options = params.dup
email = options.delete(:email) email = options.delete(:email)
if MailHandler.receive(email, options) if MailHandler.receive(email, options)
render :nothing => true, :status => :created
head :created
else else
render :nothing => true, :status => :unprocessable_entity
head :unprocessable_entity
end end
end end



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

@user.pref.save @user.pref.save
end end
end end
render :nothing => true
head 200
end end
end end

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

@entries = @repository.entries(@path, @rev) @entries = @repository.entries(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev) @changeset = @repository.find_changeset_by_name(@rev)
if request.xhr? if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
@entries ? render(:partial => 'dir_list_content') : head(200)
else else
(show_error_not_found; return) unless @entries (show_error_not_found; return) unless @entries
@changesets = @repository.latest_changesets(@path, @rev) @changesets = @repository.latest_changesets(@path, @rev)

+ 2
- 2
app/controllers/roles_controller.rb View File

flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to roles_path(:page => params[:page]) redirect_to roles_path(:page => params[:page])
} }
format.js { render :nothing => true }
format.js { head 200 }
end end
else else
respond_to do |format| respond_to do |format|
format.html { render :action => 'edit' } format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
format.js { head 422 }
end end
end end
end end

+ 4
- 4
app/controllers/sys_controller.rb View File

def create_project_repository def create_project_repository
project = Project.find(params[:id]) project = Project.find(params[:id])
if project.repository if project.repository
render :nothing => true, :status => 409
head 409
else else
logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}." logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}."
repository = Repository.factory(params[:vendor], params[:repository]) repository = Repository.factory(params[:vendor], params[:repository])
if repository.save if repository.save
render :xml => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201 render :xml => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
else else
render :nothing => true, :status => 422
head 422
end end
end end
end end
repository.fetch_changesets repository.fetch_changesets
end end
end end
render :nothing => true, :status => 200
head 200
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render :nothing => true, :status => 404
head 404
end end


protected protected

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

def show def show
respond_to do |format| respond_to do |format|
# TODO: Implement html response # TODO: Implement html response
format.html { render :nothing => true, :status => 406 }
format.html { head 406 }
format.api format.api
end end
end end

+ 2
- 2
app/controllers/trackers_controller.rb View File

flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to trackers_path(:page => params[:page]) redirect_to trackers_path(:page => params[:page])
} }
format.js { render :nothing => true }
format.js { head 200 }
end end
else else
respond_to do |format| respond_to do |format|
edit edit
render :action => 'edit' render :action => 'edit'
} }
format.js { render :nothing => true, :status => 422 }
format.js { head 422 }
end end
end end
end end

Loading…
Cancel
Save