diff --git a/enterprise/app/controllers/api/v1/accounts/whatsapp_calls_controller.rb b/enterprise/app/controllers/api/v1/accounts/whatsapp_calls_controller.rb index 04ba67dd1..b54940586 100644 --- a/enterprise/app/controllers/api/v1/accounts/whatsapp_calls_controller.rb +++ b/enterprise/app/controllers/api/v1/accounts/whatsapp_calls_controller.rb @@ -132,7 +132,10 @@ class Api::V1::Accounts::WhatsappCallsController < Api::V1::Accounts::BaseContro return render_could_not_create_error(I18n.t('errors.whatsapp.calls.permission_request_failed')) if status == 'failed' - render json: { status: status } + # 422 (not 200) so any client treating 2xx as "call placed" can't mistake + # the permission-template path for a successful dial. The FE composable + # detects this status and surfaces the banner instead of throwing. + render json: { status: status }, status: :unprocessable_entity end def permission_request_throttled? diff --git a/enterprise/app/models/enterprise/concerns/attachment.rb b/enterprise/app/models/enterprise/concerns/attachment.rb index 06b8b641a..21a13272b 100644 --- a/enterprise/app/models/enterprise/concerns/attachment.rb +++ b/enterprise/app/models/enterprise/concerns/attachment.rb @@ -14,8 +14,10 @@ module Enterprise::Concerns::Attachment def enqueue_audio_transcription return unless file_type.to_sym == :audio - return unless file.attached? + # No file.attached? guard: the social-media ingest path saves the + # Attachment before attaching the blob. AudioTranscriptionJob retries + # on ActiveStorage::FileNotFoundError to ride out that race. Messages::AudioTranscriptionJob.perform_later(id) end