Replace render nothing: true with head
This commit is contained in:
parent
80c241bc7a
commit
150fea6edb
14 changed files with 41 additions and 41 deletions
|
|
@ -22,7 +22,7 @@ class AspectsController < ApplicationController
|
|||
|
||||
render json: result
|
||||
else
|
||||
render nothing: true, status: 422
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ class AspectsController < ApplicationController
|
|||
params[:ordered_aspect_ids].each_with_index do |id, i|
|
||||
current_user.aspects.find(id).update_attributes(order_id: i)
|
||||
end
|
||||
render nothing: true
|
||||
head :no_content
|
||||
end
|
||||
|
||||
def toggle_chat_privilege
|
||||
|
|
@ -79,7 +79,7 @@ class AspectsController < ApplicationController
|
|||
|
||||
@aspect.chat_enabled = !@aspect.chat_enabled
|
||||
@aspect.save
|
||||
render :nothing => true
|
||||
head :no_content
|
||||
end
|
||||
|
||||
def toggle_contact_visibility
|
||||
|
|
@ -91,7 +91,7 @@ class AspectsController < ApplicationController
|
|||
@aspect.contacts_visible = true
|
||||
end
|
||||
@aspect.save
|
||||
render :nothing => true
|
||||
head :no_content
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class BlocksController < ApplicationController
|
|||
disconnect_if_contact(block.person) if block.save
|
||||
|
||||
respond_with do |format|
|
||||
format.json{ render :nothing => true, :status => 204 }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ class BlocksController < ApplicationController
|
|||
current_user.blocks.find(params[:id]).delete
|
||||
|
||||
respond_with do |format|
|
||||
format.json{ render :nothing => true, :status => 204 }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class CommentsController < ApplicationController
|
|||
respond_to :html, :mobile, :json
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render nothing: true, status: 404
|
||||
head :not_found
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
@ -57,7 +57,7 @@ class CommentsController < ApplicationController
|
|||
def respond_create_success(comment)
|
||||
respond_to do |format|
|
||||
format.json { render json: CommentPresenter.new(comment), status: 201 }
|
||||
format.html { render nothing: true, status: 201 }
|
||||
format.html { head :created }
|
||||
format.mobile { render partial: "comment", locals: {comment: comment} }
|
||||
end
|
||||
end
|
||||
|
|
@ -65,16 +65,16 @@ class CommentsController < ApplicationController
|
|||
def respond_destroy_success
|
||||
respond_to do |format|
|
||||
format.mobile { redirect_back fallback_location: stream_path }
|
||||
format.js { render nothing: true, status: 204 }
|
||||
format.json { render nothing: true, status: 204 }
|
||||
format.js { head :no_content }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def respond_destroy_error
|
||||
respond_to do |format|
|
||||
format.mobile { redirect_back fallback_location: stream_path }
|
||||
format.js { render nothing: true, status: 403 }
|
||||
format.json { render nothing: true, status: 403 }
|
||||
format.js { head :forbidden }
|
||||
format.json { head :forbidden }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class ConversationsController < ApplicationController
|
|||
@conversation.set_read(current_user)
|
||||
render partial: "conversations/show", locals: {conversation: @conversation}
|
||||
else
|
||||
render nothing: true, status: 404
|
||||
head :not_found
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class LikesController < ApplicationController
|
|||
render text: I18n.t("likes.create.error"), status: 422
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render nothing: true, status: 201 }
|
||||
format.html { head :created }
|
||||
format.mobile { redirect_to post_path(like.post_id) }
|
||||
format.json { render json: like.as_api_response(:backbone), status: 201 }
|
||||
end
|
||||
|
|
@ -24,7 +24,7 @@ class LikesController < ApplicationController
|
|||
|
||||
def destroy
|
||||
if like_service.destroy(params[:id])
|
||||
render nothing: true, status: 204
|
||||
head :no_content
|
||||
else
|
||||
render text: I18n.t("likes.destroy.error"), status: 404
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ class ParticipationsController < ApplicationController
|
|||
post = current_user.find_visible_shareable_by_id(Post, params[:post_id])
|
||||
if post
|
||||
current_user.participate! post
|
||||
render nothing: true, status: :created
|
||||
head :created
|
||||
else
|
||||
render nothing: true, status: :forbidden
|
||||
head :forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -15,9 +15,9 @@ class ParticipationsController < ApplicationController
|
|||
participation = current_user.participations.find_by target_id: params[:post_id]
|
||||
if participation
|
||||
participation.destroy
|
||||
render nothing: true, status: :ok
|
||||
head :ok
|
||||
else
|
||||
render nothing: true, status: :unprocessable_entity
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class PeopleController < ApplicationController
|
|||
rescue_from Diaspora::AccountClosed do
|
||||
respond_to do |format|
|
||||
format.any { redirect_back fallback_location: root_path, notice: t("people.show.closed_account") }
|
||||
format.json { render :nothing => true, :status => 410 } # 410 GONE
|
||||
format.json { head :gone }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -115,15 +115,15 @@ class PeopleController < ApplicationController
|
|||
def retrieve_remote
|
||||
if params[:diaspora_handle]
|
||||
Workers::FetchWebfinger.perform_async(params[:diaspora_handle])
|
||||
render :nothing => true
|
||||
head :ok
|
||||
else
|
||||
render :nothing => true, :status => 422
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def contacts
|
||||
respond_to do |format|
|
||||
format.json { render nothing: true, status: 406 }
|
||||
format.json { head :not_acceptable }
|
||||
|
||||
format.any do
|
||||
@person = Person.find_by_guid(params[:person_id])
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ class PhotosController < ApplicationController
|
|||
:status => 201}
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => 422
|
||||
head :unprocessable_entity
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => 422
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class PhotosController < ApplicationController
|
|||
current_user.retract(photo)
|
||||
|
||||
respond_to do |format|
|
||||
format.json{ render :nothing => true, :status => 204 }
|
||||
format.json { head :no_content }
|
||||
format.html do
|
||||
flash[:notice] = I18n.t 'photos.destroy.notice'
|
||||
if StatusMessage.find_by_guid(photo.status_message_guid)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class PollParticipationsController < ApplicationController
|
|||
rescue ActiveRecord::RecordInvalid
|
||||
respond_to do |format|
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render :nothing => true, :status => 403 }
|
||||
format.json { head :forbidden }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class PostsController < ApplicationController
|
|||
oembed = params.slice(:format, :maxheight, :minheight)
|
||||
render json: OEmbedPresenter.new(post, oembed)
|
||||
rescue
|
||||
render nothing: true, status: 404
|
||||
head :not_found
|
||||
end
|
||||
|
||||
def interactions
|
||||
|
|
@ -45,7 +45,7 @@ class PostsController < ApplicationController
|
|||
post = post_service.find!(params[:id])
|
||||
render json: PostInteractionPresenter.new(post, current_user)
|
||||
}
|
||||
format.any { render nothing: true, status: 406 }
|
||||
format.any { head :not_acceptable }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -55,19 +55,19 @@ class PostsController < ApplicationController
|
|||
if params[:id].present? && params[:q].present?
|
||||
render json: post_service.mentionable_in_comment(params[:id], params[:q])
|
||||
else
|
||||
render nothing: true, status: 204
|
||||
head :no_content
|
||||
end
|
||||
}
|
||||
format.any { render nothing: true, status: 406 }
|
||||
format.any { head :not_acceptable }
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render nothing: true, status: 404
|
||||
head :not_found
|
||||
end
|
||||
|
||||
def destroy
|
||||
post_service.destroy(params[:id])
|
||||
respond_to do |format|
|
||||
format.json { render nothing: true, status: 204 }
|
||||
format.json { head :no_content }
|
||||
format.any { redirect_to stream_path }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class ProfilesController < ApplicationController
|
|||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 200 }
|
||||
format.js { head :ok }
|
||||
format.any {
|
||||
if current_user.getting_started?
|
||||
redirect_to getting_started_path
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class ReportController < ApplicationController
|
|||
if report.save
|
||||
render json: true, status: 200
|
||||
else
|
||||
render nothing: true, status: 409
|
||||
head :conflict
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class TagFollowingsController < ApplicationController
|
|||
name_normalized = ActsAsTaggableOn::Tag.normalize(params['name'])
|
||||
|
||||
if name_normalized.nil? || name_normalized.empty?
|
||||
render :nothing => true, :status => 403
|
||||
head :forbidden
|
||||
else
|
||||
@tag = ActsAsTaggableOn::Tag.find_or_create_by(name: name_normalized)
|
||||
@tag_following = current_user.tag_followings.new(:tag_id => @tag.id)
|
||||
|
|
@ -23,7 +23,7 @@ class TagFollowingsController < ApplicationController
|
|||
if @tag_following.save
|
||||
render :json => @tag.to_json, :status => 201
|
||||
else
|
||||
render :nothing => true, :status => 403
|
||||
head :forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -35,11 +35,11 @@ class TagFollowingsController < ApplicationController
|
|||
|
||||
if tag_following && tag_following.destroy
|
||||
respond_to do |format|
|
||||
format.any(:js, :json) { render :nothing => true, :status => 204 }
|
||||
format.any(:js, :json) { head :no_content }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.any(:js, :json) {render :nothing => true, :status => 403}
|
||||
format.any(:js, :json) { head :forbidden }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ class TagsController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.json{ render :nothing => true, :status => 422 }
|
||||
format.html{ redirect_to tag_path('partytimeexcellent') }
|
||||
format.json { head :unprocessable_entity }
|
||||
format.html { redirect_to tag_path("partytimeexcellent") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue