Prevents Captain from being scheduled for replies or inactive-conversation resolution when an inbox already has an active AgentBot or Dialogflow integration. ## Closes [CW-7834](https://linear.app/chatwoot/issue/CW-7834/prevent-captain-from-processing-agentbot-and-dialogflow-conversations) ## Why Captain and an external inbox bot could both process conversations from the same inbox. ## What this change does - Distinguishes external inbox bots from Captain in the existing bot predicate. - Skips Captain reply scheduling when an external bot is active. - Skips Captain inactive-resolution scheduling when an external bot is active. ## Validation - Connect an AgentBot to a Captain-enabled inbox and confirm Captain does not reply or schedule inactive resolution. - Enable Dialogflow on a Captain-enabled inbox and confirm Captain does not reply. - Remove the external bot integration and confirm Captain resumes normal processing. --------- Co-authored-by: Aakash Bakhle <48802744+aakashb95@users.noreply.github.com>
18 lines
297 B
Ruby
18 lines
297 B
Ruby
module InboxBotStatus
|
|
extend ActiveSupport::Concern
|
|
|
|
def active_bot?
|
|
external_bot_active?
|
|
end
|
|
|
|
def external_bot_active?
|
|
agent_bot_inbox&.active? || dialogflow_active?
|
|
end
|
|
|
|
private
|
|
|
|
def dialogflow_active?
|
|
hooks.exists?(app_id: %w[dialogflow], status: 'enabled')
|
|
end
|
|
end
|