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