diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-01-11 02:41:35 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-01-11 02:41:35 -0600 |
commit | ff67dbed2b2878ba0d8032bdde08e06bc0eead3e (patch) | |
tree | 805919a162596e67dc8803f9db7892eefc289ea4 /app/controllers/api/v1/accounts | |
parent | d9a9a18afae94ec0a2160e746265e47d7b639eaf (diff) |
pass monsterfork api exposure setting to all serializers + add `MONSTERFORK_API_FORCE_*` env vars to set api compatability modes for clients/apps
Diffstat (limited to 'app/controllers/api/v1/accounts')
9 files changed, 11 insertions, 11 deletions
diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb index e77f57910..7cbea0ab9 100644 --- a/app/controllers/api/v1/accounts/credentials_controller.rb +++ b/app/controllers/api/v1/accounts/credentials_controller.rb @@ -7,7 +7,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController def show @account = current_account - render json: @account, serializer: REST::CredentialAccountSerializer + render json: @account, serializer: REST::CredentialAccountSerializer, monsterfork_api: monsterfork_api end def update @@ -15,7 +15,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController UpdateAccountService.new.call(@account, account_params, raise_error: true) UserSettingsDecorator.new(current_user).update(user_settings_params) if user_settings_params ActivityPub::UpdateDistributionWorker.perform_async(@account.id) - render json: @account, serializer: REST::CredentialAccountSerializer + render json: @account, serializer: REST::CredentialAccountSerializer, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/follower_accounts_controller.rb b/app/controllers/api/v1/accounts/follower_accounts_controller.rb index 166d64495..a86b5bb51 100644 --- a/app/controllers/api/v1/accounts/follower_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/follower_accounts_controller.rb @@ -9,7 +9,7 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController def index @accounts = load_accounts - render json: @accounts, each_serializer: REST::AccountSerializer + render json: @accounts, each_serializer: REST::AccountSerializer, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/following_accounts_controller.rb b/app/controllers/api/v1/accounts/following_accounts_controller.rb index 8fa523463..45feababf 100644 --- a/app/controllers/api/v1/accounts/following_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/following_accounts_controller.rb @@ -9,7 +9,7 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController def index @accounts = load_accounts - render json: @accounts, each_serializer: REST::AccountSerializer + render json: @accounts, each_serializer: REST::AccountSerializer, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/identity_proofs_controller.rb b/app/controllers/api/v1/accounts/identity_proofs_controller.rb index bea51ae11..286df7a41 100644 --- a/app/controllers/api/v1/accounts/identity_proofs_controller.rb +++ b/app/controllers/api/v1/accounts/identity_proofs_controller.rb @@ -8,7 +8,7 @@ class Api::V1::Accounts::IdentityProofsController < Api::BaseController def index @proofs = @account.identity_proofs.active - render json: @proofs, each_serializer: REST::IdentityProofSerializer + render json: @proofs, each_serializer: REST::IdentityProofSerializer, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/lists_controller.rb b/app/controllers/api/v1/accounts/lists_controller.rb index 72392453c..dd6402b34 100644 --- a/app/controllers/api/v1/accounts/lists_controller.rb +++ b/app/controllers/api/v1/accounts/lists_controller.rb @@ -9,7 +9,7 @@ class Api::V1::Accounts::ListsController < Api::BaseController def index @lists = @account.lists.where(account: current_account) - render json: @lists, each_serializer: REST::ListSerializer + render json: @lists, each_serializer: REST::ListSerializer, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/pins_controller.rb b/app/controllers/api/v1/accounts/pins_controller.rb index 0a0239c42..c37c0d0d0 100644 --- a/app/controllers/api/v1/accounts/pins_controller.rb +++ b/app/controllers/api/v1/accounts/pins_controller.rb @@ -11,13 +11,13 @@ class Api::V1::Accounts::PinsController < Api::BaseController def create AccountPin.create!(account: current_account, target_account: @account) - render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships_presenter + render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships_presenter, monsterfork_api: monsterfork_api end def destroy pin = AccountPin.find_by(account: current_account, target_account: @account) pin&.destroy! - render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships_presenter + render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships_presenter, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/relationships_controller.rb b/app/controllers/api/v1/accounts/relationships_controller.rb index e8e777ae8..a146596d5 100644 --- a/app/controllers/api/v1/accounts/relationships_controller.rb +++ b/app/controllers/api/v1/accounts/relationships_controller.rb @@ -15,7 +15,7 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController else @accounts = Account.none end - render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships + render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/search_controller.rb b/app/controllers/api/v1/accounts/search_controller.rb index b15268923..47477f164 100644 --- a/app/controllers/api/v1/accounts/search_controller.rb +++ b/app/controllers/api/v1/accounts/search_controller.rb @@ -8,7 +8,7 @@ class Api::V1::Accounts::SearchController < Api::BaseController def show @accounts = account_search - render json: @accounts, each_serializer: REST::AccountSerializer + render json: @accounts, each_serializer: REST::AccountSerializer, monsterfork_api: monsterfork_api end private diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index 35fcce2dd..bd0fbd686 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -9,7 +9,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController def index @statuses = load_statuses - render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id) + render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id), monsterfork_api: monsterfork_api end private |