fix: Send CSAT survey only when agent can reply in conversation (#11637)
This commit is contained in:
@@ -17,7 +17,6 @@ class MessageTemplates::HookExecutionService
|
||||
::MessageTemplates::Template::OutOfOffice.new(conversation: conversation).perform if should_send_out_of_office_message?
|
||||
::MessageTemplates::Template::Greeting.new(conversation: conversation).perform if should_send_greeting?
|
||||
::MessageTemplates::Template::EmailCollect.new(conversation: conversation).perform if inbox.enable_email_collect && should_send_email_collect?
|
||||
::MessageTemplates::Template::CsatSurvey.new(conversation: conversation).perform if should_send_csat_survey?
|
||||
end
|
||||
|
||||
def should_send_out_of_office_message?
|
||||
@@ -55,23 +54,5 @@ class MessageTemplates::HookExecutionService
|
||||
def contact_has_email?
|
||||
contact.email
|
||||
end
|
||||
|
||||
def csat_enabled_conversation?
|
||||
return false unless conversation.resolved?
|
||||
# should not sent since the link will be public
|
||||
return false if conversation.tweet?
|
||||
return false unless inbox.csat_survey_enabled?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def should_send_csat_survey?
|
||||
return unless csat_enabled_conversation?
|
||||
|
||||
# only send CSAT once in a conversation
|
||||
return if conversation.messages.where(content_type: :input_csat).present?
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
MessageTemplates::HookExecutionService.prepend_mod_with('MessageTemplates::HookExecutionService')
|
||||
|
||||
Reference in New Issue
Block a user