fix: Feature flags are not be stored on account creation (#10387)

when creating an account via the platform API the feature flags do not get stored

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Honza Sterba
2024-11-20 13:39:17 +00:00
committed by GitHub
parent 93ebfccac2
commit 76a4140224
2 changed files with 4 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ class Platform::Api::V1::AccountsController < PlatformController
def create
@resource = Account.create!(account_params)
update_resource_features
@resource.save!
@platform_app.platform_app_permissibles.find_or_create_by(permissible: @resource)
end

View File

@@ -60,11 +60,10 @@ RSpec.describe 'Platform Accounts API', type: :request do
} }, headers: { api_access_token: platform_app.access_token.token }, as: :json
json_response = response.parsed_body
created_account = Account.find(json_response['id'])
expect(created_account.enabled_features.keys).to match_array(%w[inbox_management ip_lookup help_center])
expect(json_response['name']).to include('Test Account')
expect(json_response['features']['inbox_management']).to be(true)
expect(json_response['features']['ip_lookup']).to be(true)
expect(json_response['features']['help_center']).to be(true)
expect(json_response['features']['disable_branding']).to be_nil
expect(json_response['features'].keys).to match_array(%w[inbox_management ip_lookup help_center])
end
it 'creates an account with limits settings' do