feat: Integration with Captain (alpha) (#9834)

- Integration with captain (alpha)

Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2024-07-25 14:24:04 -07:00
committed by GitHub
parent 027a540bbd
commit 0331815cc5
14 changed files with 159 additions and 17 deletions

View File

@@ -129,7 +129,16 @@ class Inbox < ApplicationRecord
end
def active_bot?
agent_bot_inbox&.active? || hooks.where(app_id: 'dialogflow', status: 'enabled').count.positive?
agent_bot_inbox&.active? || hooks.where(app_id: %w[dialogflow],
status: 'enabled').count.positive? || captain_enabled?
end
def captain_enabled?
captain_hook = account.hooks.where(
app_id: %w[captain], status: 'enabled'
).first
captain_hook.present? && captain_hook.settings['inbox_ids'].split(',').include?(id.to_s)
end
def inbox_type

View File

@@ -34,12 +34,14 @@ class Integrations::App
end
end
def active?
def active?(account)
case params[:id]
when 'slack'
ENV['SLACK_CLIENT_SECRET'].present?
when 'linear'
Current.account.feature_enabled?('linear_integration')
account.feature_enabled?('linear_integration')
when 'captain'
account.feature_enabled?('captain_integration') && ENV['CAPTAIN_API_URL'].present?
else
true
end