fix: captain talking over support agent (#13673)

This commit is contained in:
Aakash Bakhle
2026-03-03 16:13:34 +05:30
committed by GitHub
parent 89da4a2292
commit 374d2258c7
7 changed files with 151 additions and 4 deletions

View File

@@ -310,6 +310,7 @@ class Message < ApplicationRecord
def execute_after_create_commit_callbacks
# rails issue with order of active record callbacks being executed https://github.com/rails/rails/issues/20911
reopen_conversation
mark_pending_conversation_as_open_for_human_response
set_conversation_activity
dispatch_create_events
send_reply
@@ -390,6 +391,18 @@ class Message < ApplicationRecord
reopen_resolved_conversation if conversation.resolved?
end
def mark_pending_conversation_as_open_for_human_response
return unless captain_pending_conversation?
return unless human_response?
return if private?
conversation.open!
end
def captain_pending_conversation?
false
end
def reopen_resolved_conversation
# mark resolved bot conversation as pending to be reopened by bot processor service
if conversation.inbox.active_bot?