From 5805c511bbef00261a31d886fc92a397a9aecc36 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Sat, 22 Sep 2018 13:03:35 -0500 Subject: [PATCH] Convert `render :text` to `render :body` Co-Authored-By: Dan Rice --- app/controllers/application_controller.rb | 4 ++-- app/controllers/contexts_controller.rb | 8 ++++---- app/controllers/integrations_controller.rb | 6 +++--- app/controllers/notes_controller.rb | 2 +- app/controllers/preferences_controller.rb | 2 +- app/controllers/projects_controller.rb | 8 ++++---- app/controllers/todos_controller.rb | 4 ++-- app/controllers/users_controller.rb | 4 ++-- lib/login_system.rb | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1bacd50d..8d98d517 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base end def render_failure message, status = 404 - render :text => message, :status => status + render :body => message, :status => status end # Returns a count of next actions in the given context or project The result @@ -147,7 +147,7 @@ class ApplicationController < ActionController::Base def admin_login_required unless User.find(session['user_id']).is_admin - render :text => t('errors.user_unauthorized'), :status => 401 + render :body => t('errors.user_unauthorized'), :status => 401 return false end end diff --git a/app/controllers/contexts_controller.rb b/app/controllers/contexts_controller.rb index c8d36a90..0bc537a9 100644 --- a/app/controllers/contexts_controller.rb +++ b/app/controllers/contexts_controller.rb @@ -61,7 +61,7 @@ class ContextsController < ApplicationController end else respond_to do |format| - format.html { render :text => 'Context not found', :status => 404 } + format.html { render :body => 'Context not found', :status => 404 } format.xml { render :xml => 'Context not found', :status => 404 } end end @@ -116,7 +116,7 @@ class ContextsController < ApplicationController if @saved render :xml => @context.to_xml( :except => :user_id ) else - render :text => "Error on update: #{@context.errors.full_messages.inject("") {|v, e| v + e + " " }}", :status => 409 + render :body => "Error on update: #{@context.errors.full_messages.inject("") {|v, e| v + e + " " }}", :status => 409 end } end @@ -142,7 +142,7 @@ class ContextsController < ApplicationController @down_count = current_user.contexts.size update_state_counts end - format.xml { render :text => "Deleted context #{@context.name}" } + format.xml { render :body => "Deleted context #{@context.name}" } end end @@ -222,7 +222,7 @@ class ContextsController < ApplicationController def render_autocomplete lambda do - render :text => for_autocomplete(current_user.contexts, params[:term]) + render :body => for_autocomplete(current_user.contexts, params[:term]) end end diff --git a/app/controllers/integrations_controller.rb b/app/controllers/integrations_controller.rb index 3a3da549..dcab4e9d 100644 --- a/app/controllers/integrations_controller.rb +++ b/app/controllers/integrations_controller.rb @@ -19,14 +19,14 @@ class IntegrationsController < ApplicationController def cloudmailin if !verify_cloudmailin_signature - render :text => "Message signature verification failed.", :status => 403 + render :body => "Message signature verification failed.", :status => 403 return false end if process_message(params[:message]) - render :text => 'success', :status => 200 + render :body => 'success', :status => 200 else - render :text => "No user found or other error", :status => 404 + render :body => "No user found or other error", :status => 404 end end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 402ca898..0ed4091a 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -38,7 +38,7 @@ class NotesController < ApplicationController end end format.html do - render :text => 'unexpected request for html rendering' + render :body => 'unexpected request for html rendering' end end end diff --git a/app/controllers/preferences_controller.rb b/app/controllers/preferences_controller.rb index bf799e55..4781f121 100644 --- a/app/controllers/preferences_controller.rb +++ b/app/controllers/preferences_controller.rb @@ -28,7 +28,7 @@ class PreferencesController < ApplicationController def render_date_format format = params[:date_format] - render :text => l(Date.current, :format => format) + render :body => l(Date.current, :format => format) end private diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 059ab9ac..d7c12454 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -48,7 +48,7 @@ class ProjectsController < ApplicationController end format.autocomplete do projects = current_user.projects.active + current_user.projects.hidden - render :text => for_autocomplete(projects, params[:term]) + render :body => for_autocomplete(projects, params[:term]) end end end @@ -237,7 +237,7 @@ class ProjectsController < ApplicationController @projects = current_user.projects template = 'projects/update_project_name' else - render :text => success_text || 'Success' + render :body => success_text || 'Success' return end else @@ -252,7 +252,7 @@ class ProjectsController < ApplicationController if @saved render :xml => @project.to_xml( :except => :user_id ) else - render :text => "Error on update: #{@project.errors.full_messages.inject("") {|v, e| v + e + " " }}", :status => 409 + render :body => "Error on update: #{@project.errors.full_messages.inject("") {|v, e| v + e + " " }}", :status => 409 end } end @@ -274,7 +274,7 @@ class ProjectsController < ApplicationController @down_count = current_user.projects.size update_state_counts } - format.xml { render :text => "Deleted project #{@project.name}" } + format.xml { render :body => "Deleted project #{@project.name}" } end end diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index a4e87ce7..e3161c9f 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -544,7 +544,7 @@ class TodosController < ApplicationController render end - format.xml { render :text => '200 OK. Action deleted.', :status => 200 } + format.xml { render :body => '200 OK. Action deleted.', :status => 200 } end end @@ -710,7 +710,7 @@ class TodosController < ApplicationController tags_all = tags_all - tags_beginning respond_to do |format| - format.autocomplete { render :text => for_autocomplete(tags_beginning+tags_all, params[:term]) } + format.autocomplete { render :body => for_autocomplete(tags_beginning+tags_all, params[:term]) } end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f33979e6..6d8366dd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -99,7 +99,7 @@ class UsersController < ApplicationController end format.xml do unless current_user && current_user.is_admin - render :text => "401 Unauthorized: Only admin users are allowed access to this function.", :status => 401 + render :body => "401 Unauthorized: Only admin users are allowed access to this function.", :status => 401 return end unless check_create_user_params @@ -110,7 +110,7 @@ class UsersController < ApplicationController user.password_confirmation = user_params[:password] saved = user.save unless user.new_record? - render :text => t('users.user_created'), :status => 200 + render :body => t('users.user_created'), :status => 200 else render_failure user.errors.to_xml, 409 end diff --git a/lib/login_system.rb b/lib/login_system.rb index 999b6fa8..1d3f6b0a 100644 --- a/lib/login_system.rb +++ b/lib/login_system.rb @@ -206,7 +206,7 @@ module LoginSystem def basic_auth_denied response.headers["WWW-Authenticate"] = "Basic realm=\"'Tracks Login Required'\"" - render :text => t('login.unsuccessful'), :status => 401 + render :body => t('login.unsuccessful'), :status => 401 end private