From 275032183059d23cacfb7021f7823ee98430c6fc Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 22 Jul 2026 17:06:52 -0700 Subject: [PATCH] refactor: tidy connected bot ownership flow --- app/controllers/api/v1/accounts/conversations_controller.rb | 2 +- app/models/conversation.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/accounts/conversations_controller.rb b/app/controllers/api/v1/accounts/conversations_controller.rb index 7b18a983d..1b3933d99 100644 --- a/app/controllers/api/v1/accounts/conversations_controller.rb +++ b/app/controllers/api/v1/accounts/conversations_controller.rb @@ -181,7 +181,7 @@ class Api::V1::Accounts::ConversationsController < Api::V1::Accounts::BaseContro def handle_human_open @conversation.assignee_agent_bot = nil - @conversation.assignee = current_user if current_user.agent? + @conversation.assignee = Current.user if Current.user.agent? @conversation.save! end diff --git a/app/models/conversation.rb b/app/models/conversation.rb index 1b6b90199..f629658d5 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -300,10 +300,10 @@ class Conversation < ApplicationRecord end def set_active_bot_conversation + # TODO: make this an inbox config instead of assuming bot conversations should start as pending self.status = :pending return unless inbox.agent_bot_inbox&.active? && assignee_id.blank? - self.assignee = nil self.assignee_agent_bot = inbox.agent_bot end