about summary refs log tree commit diff
path: root/app/controllers/api/v1/accounts_controller.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-04-01 21:28:31 +0200
committerThibaut Girka <thib@sitedethib.com>2019-04-01 21:28:31 +0200
commit12dae9d58316bec32adaac016998ab1cf69d2b45 (patch)
tree4ddadcc66d07a1edfcfb9ff0f9cda7cf107d6b46 /app/controllers/api/v1/accounts_controller.rb
parent925830d11bb5c132e282f82bdb2ca893d87c9c24 (diff)
parent120544067fcca4bf6e71ba1ffb276c451c17c656 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/models/form/admin_settings.rb
- config/locales/ja.yml
Diffstat (limited to 'app/controllers/api/v1/accounts_controller.rb')
-rw-r--r--app/controllers/api/v1/accounts_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index b0c62778e..685e044c3 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -10,6 +10,7 @@ class Api::V1::AccountsController < Api::BaseController
   before_action :require_user!, except: [:show, :create]
   before_action :set_account, except: [:create]
   before_action :check_account_suspension, only: [:show]
+  before_action :check_account_block, only: [:show]
   before_action :check_enabled_registrations, only: [:create]
 
   respond_to :json
@@ -75,6 +76,10 @@ class Api::V1::AccountsController < Api::BaseController
     gone if @account.suspended?
   end
 
+  def check_account_block
+    gone if current_account.present? && @account.blocking?(current_account)
+  end
+
   def account_params
     params.permit(:username, :email, :password, :agreement, :locale)
   end