fix: keep agent bot takeover guard human-only

This commit is contained in:
Sojan Jose
2026-06-28 20:49:26 -07:00
parent b9834c3a18
commit 950ebcacd4
3 changed files with 20 additions and 6 deletions
@@ -74,7 +74,7 @@ class Api::V1::Accounts::Conversations::MessagesController < Api::V1::Accounts::
end
def ensure_agent_bot_takeover
return unless Current.user && @conversation.assignee_agent_bot_id.present?
return unless Current.user.is_a?(User) && @conversation.assignee_agent_bot_id.present?
return if private_message? || incoming_message?
render json: { error: 'Conversation is assigned to an Agent Bot. Take over the conversation before replying.' }, status: :unprocessable_entity