]> cat aescling's git repositories - mastodon.git/commitdiff
Return HTTP 410 for suspended accounts in GET /api/v1/accounts/:id (#7287)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 30 Apr 2018 07:12:36 +0000 (09:12 +0200)
committerGitHub <noreply@github.com>
Mon, 30 Apr 2018 07:12:36 +0000 (09:12 +0200)
Fix #7243

app/controllers/api/v1/accounts_controller.rb

index d6432594410406219ab7ad63f187e1ea7a49c304..b7133ca8e56fc6a667336569325211af25c781ed 100644 (file)
@@ -5,6 +5,7 @@ class Api::V1::AccountsController < Api::BaseController
   before_action -> { doorkeeper_authorize! :follow }, only: [:follow, :unfollow, :block, :unblock, :mute, :unmute]
   before_action :require_user!, except: [:show]
   before_action :set_account
+  before_action :check_account_suspension, only: [:show]
 
   respond_to :json
 
@@ -54,4 +55,8 @@ class Api::V1::AccountsController < Api::BaseController
   def relationships(**options)
     AccountRelationshipsPresenter.new([@account.id], current_user.account_id, options)
   end
+
+  def check_account_suspension
+    gone if @account.suspended?
+  end
 end