refactor: clarify connected agent bot conversation setup

This commit is contained in:
Sojan Jose
2026-07-06 22:25:59 -07:00
parent 3ace6f01eb
commit 73054c6a94
+9 -5
View File
@@ -282,17 +282,21 @@ class Conversation < ApplicationRecord
return handle_campaign_status if campaign.present?
# TODO: make this an inbox config instead of assuming bot conversations should start as pending
assign_connected_agent_bot if inbox.agent_bot_inbox&.active?
self.status = :pending if inbox.active_bot?
return unless inbox.active_bot?
self.status = :pending
assign_connected_agent_bot if connected_agent_bot_inbox?
end
def handle_campaign_status
# If campaign has no sender (bot-initiated) and inbox has active bot, let bot handle it
return unless campaign.sender_id.nil? && inbox.active_bot?
assign_connected_agent_bot if inbox.agent_bot_inbox&.active?
self.status = :pending
assign_connected_agent_bot if connected_agent_bot_inbox?
end
def connected_agent_bot_inbox?
inbox.agent_bot_inbox&.active?
end
def assign_connected_agent_bot