diff --git a/app/controllers/api/v1/accounts/agents_controller.rb b/app/controllers/api/v1/accounts/agents_controller.rb index 221c96b85..e925d59d5 100644 --- a/app/controllers/api/v1/accounts/agents_controller.rb +++ b/app/controllers/api/v1/accounts/agents_controller.rb @@ -49,6 +49,9 @@ class Api::V1::Accounts::AgentsController < Api::V1::Accounts::BaseController Rails.logger.info "[Agent#bulk_create] ignoring email #{email}, errors: #{e.record.errors}" end end + # remove onboarding_step key in present in Current account custom attributes + Current.account.custom_attributes.delete('onboarding_step') + Current.account.save! head :ok end diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 0d4ad36b7..b3c178d2e 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -43,7 +43,7 @@ class Api::V1::AccountsController < Api::BaseController def update @account.assign_attributes(account_params.slice(:name, :locale, :domain, :support_email, :auto_resolve_duration)) - @account.custom_attributes.merge!(custom_attributes_params) + @account.custom_attributes['onboarding_step'] = 'invite_team' if custom_attributes_params[:onboarding_step].present? @account.save! end diff --git a/app/views/api/v1/models/_account.json.jbuilder b/app/views/api/v1/models/_account.json.jbuilder index a270f0c9b..5e9d9048a 100644 --- a/app/views/api/v1/models/_account.json.jbuilder +++ b/app/views/api/v1/models/_account.json.jbuilder @@ -10,6 +10,7 @@ if resource.custom_attributes.present? json.company_size resource.custom_attributes['company_size'] if resource.custom_attributes['company_size'].present? json.timezone resource.custom_attributes['timezone'] if resource.custom_attributes['timezone'].present? json.logo resource.custom_attributes['logo'] if resource.custom_attributes['logo'].present? + json.onboarding_step resource.custom_attributes['onboarding_step'] if resource.custom_attributes['onboarding_step'].present? end end json.domain @account.domain diff --git a/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb b/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb index d0d76c1ae..bdd4ba2a2 100644 --- a/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb +++ b/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb @@ -28,7 +28,8 @@ module Enterprise::Api::V2::AccountsController 'industry' => data[:industry], 'company_size' => data[:company_size], 'timezone' => data[:timezone], - 'logo' => data[:logo] + 'logo' => data[:logo], + 'onboarding_step' => 'account_update' ) ) end