diff options
author | ThibG <thib@sitedethib.com> | 2019-03-20 20:13:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 20:13:22 +0100 |
commit | bde9196b70299405ebe9b16500b7a3f65539b2c3 (patch) | |
tree | 4bec904a28c70b916d18055f8291f17c2e58e07b /app/controllers/api | |
parent | b9a998f201913dd1c89ddcb0c4c9e181eb73bfcf (diff) | |
parent | 8b5b686f087f99d1a2b54e0760add8180d77fa7e (diff) |
Merge pull request #964 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api')
-rw-r--r-- | app/controllers/api/proofs_controller.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/controllers/api/proofs_controller.rb b/app/controllers/api/proofs_controller.rb new file mode 100644 index 000000000..a84ad2014 --- /dev/null +++ b/app/controllers/api/proofs_controller.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class Api::ProofsController < Api::BaseController + before_action :set_account + before_action :set_provider + before_action :check_account_approval + before_action :check_account_suspension + + def index + render json: @account, serializer: @provider.serializer_class + end + + private + + def set_provider + @provider = ProofProvider.find(params[:provider]) || raise(ActiveRecord::RecordNotFound) + end + + def set_account + @account = Account.find_local!(params[:username]) + end + + def check_account_approval + not_found if @account.user_pending? + end + + def check_account_suspension + gone if @account.suspended? + end +end |