fix: mark conv open on human message, suppress template message

This commit is contained in:
aakashb95
2026-01-15 19:57:49 +05:30
parent 8eb0558b0a
commit a1107a1b85
+9 -1
View File
@@ -310,10 +310,11 @@ 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
open_conversation_on_human_response
set_conversation_activity
dispatch_create_events
send_reply
execute_message_template_hooks
execute_message_template_hooks unless human_response? || activity?
update_contact_activity
end
@@ -389,6 +390,13 @@ class Message < ApplicationRecord
reopen_resolved_conversation if conversation.resolved?
end
def open_conversation_on_human_response
return unless human_response?
return unless conversation.pending?
conversation.open!
end
def reopen_resolved_conversation
# mark resolved bot conversation as pending to be reopened by bot processor service
if conversation.inbox.active_bot?