Fix json response status codes
This commit is contained in:
@ -27,7 +27,7 @@ class SubscriptionsController < ApplicationController
|
|||||||
skip_authorization
|
skip_authorization
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to request_for_comments_url, alert: t('subscriptions.subscription_not_existent') }
|
format.html { redirect_to request_for_comments_url, alert: t('subscriptions.subscription_not_existent') }
|
||||||
format.json { head :internal_server_error }
|
format.json { render json: {message: t('subscriptions.subscription_not_existent')}, status: :not_found }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
authorize!
|
authorize!
|
||||||
@ -35,12 +35,12 @@ class SubscriptionsController < ApplicationController
|
|||||||
if @subscription.destroy
|
if @subscription.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to request_for_comment_url(rfc), notice: t('subscriptions.successfully_unsubscribed') }
|
format.html { redirect_to request_for_comment_url(rfc), notice: t('subscriptions.successfully_unsubscribed') }
|
||||||
format.json { head :destroyed }
|
format.json { render json: {message: t('subscriptions.successfully_unsubscribed')}, status: :ok}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to request_for_comment_url(rfc), :flash => { :danger => t('shared.message_failure') } }
|
format.html { redirect_to request_for_comment_url(rfc), :flash => { :danger => t('shared.message_failure') } }
|
||||||
format.json { head :internal_server_error }
|
format.json { render json: {message: t('shared.message_failure')}, status: :internal_server_error}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user