From d5f24021a7ccf503f6defb67750aeec4a12a0c94 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 6 Aug 2017 05:07:39 +0200 Subject: [PATCH] Replace `render text: ...` with `render plain: ...` --- app/controllers/aspect_memberships_controller.rb | 10 +++++----- app/controllers/comments_controller.rb | 4 ++-- app/controllers/conversations_controller.rb | 4 ++-- app/controllers/likes_controller.rb | 4 ++-- app/controllers/posts_controller.rb | 2 +- app/controllers/reshares_controller.rb | 2 +- app/controllers/status_messages_controller.rb | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/aspect_memberships_controller.rb b/app/controllers/aspect_memberships_controller.rb index 77df0fe15..2bfd0c933 100644 --- a/app/controllers/aspect_memberships_controller.rb +++ b/app/controllers/aspect_memberships_controller.rb @@ -30,7 +30,7 @@ class AspectMembershipsController < ApplicationController if success render json: AspectMembershipPresenter.new(membership).base_hash else - render text: membership.errors.full_messages, status: 403 + render plain: membership.errors.full_messages, status: 403 end end end @@ -53,21 +53,21 @@ class AspectMembershipsController < ApplicationController else respond_to do |format| format.json do - render text: I18n.t("aspects.add_to_aspect.failure"), status: 409 + render plain: I18n.t("aspects.add_to_aspect.failure"), status: 409 end end end end rescue_from ActiveRecord::StatementInvalid do - render text: I18n.t("aspect_memberships.destroy.invalid_statement"), status: 400 + render plain: I18n.t("aspect_memberships.destroy.invalid_statement"), status: 400 end rescue_from ActiveRecord::RecordNotFound do - render text: I18n.t("aspect_memberships.destroy.no_membership"), status: 404 + render plain: I18n.t("aspect_memberships.destroy.no_membership"), status: 404 end rescue_from Diaspora::NotMine do - render text: I18n.t("aspect_memberships.destroy.forbidden"), status: 403 + render plain: I18n.t("aspect_memberships.destroy.forbidden"), status: 403 end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 214f484bb..f9d4ad47d 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -15,14 +15,14 @@ class CommentsController < ApplicationController begin comment = comment_service.create(params[:post_id], params[:text]) rescue ActiveRecord::RecordNotFound - render text: I18n.t("comments.create.error"), status: 404 + render plain: I18n.t("comments.create.error"), status: 404 return end if comment respond_create_success(comment) else - render text: I18n.t("comments.create.error"), status: 422 + render plain: I18n.t("comments.create.error"), status: 422 end end diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index 164512839..3f1977655 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -39,7 +39,7 @@ class ConversationsController < ApplicationController end unless person_ids.present? - render text: I18n.t("javascripts.conversation.create.no_recipient"), status: 422 + render plain: I18n.t("javascripts.conversation.create.no_recipient"), status: 422 return end @@ -53,7 +53,7 @@ class ConversationsController < ApplicationController flash[:notice] = I18n.t("conversations.create.sent") render json: {id: @conversation.id} else - render text: I18n.t("conversations.create.fail"), status: 422 + render plain: I18n.t("conversations.create.fail"), status: 422 end end diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb index de508f351..182760951 100644 --- a/app/controllers/likes_controller.rb +++ b/app/controllers/likes_controller.rb @@ -13,7 +13,7 @@ class LikesController < ApplicationController def create like = like_service.create(params[:post_id]) rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid - render text: I18n.t("likes.create.error"), status: 422 + render plain: I18n.t("likes.create.error"), status: 422 else respond_to do |format| format.html { head :created } @@ -26,7 +26,7 @@ class LikesController < ApplicationController if like_service.destroy(params[:id]) head :no_content else - render text: I18n.t("likes.destroy.error"), status: 404 + render plain: I18n.t("likes.destroy.error"), status: 404 end end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 1629fb765..8b5386d2b 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -13,7 +13,7 @@ class PostsController < ApplicationController end rescue_from Diaspora::NotMine do - render text: I18n.t("posts.show.forbidden"), status: 403 + render plain: I18n.t("posts.show.forbidden"), status: 403 end def show diff --git a/app/controllers/reshares_controller.rb b/app/controllers/reshares_controller.rb index 4add93174..846091398 100644 --- a/app/controllers/reshares_controller.rb +++ b/app/controllers/reshares_controller.rb @@ -5,7 +5,7 @@ class ResharesController < ApplicationController def create reshare = reshare_service.create(params[:root_guid]) rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid - render text: I18n.t("reshares.create.error"), status: 422 + render plain: I18n.t("reshares.create.error"), status: 422 else render json: ExtremePostPresenter.new(reshare, current_user), status: 201 end diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 5127cea84..58ae46536 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -66,7 +66,7 @@ class StatusMessagesController < ApplicationController logger.debug error respond_to do |format| format.mobile { redirect_to stream_path } - format.json { render text: error.message, status: 403 } + format.json { render plain: error.message, status: 403 } end end