refactor: tidy connected bot ownership flow
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user