feat: CSAT for all channels (#2749)

This commit is contained in:
Muhsin Keloth
2021-08-23 22:00:47 +05:30
committed by GitHub
parent 5debe9e8ee
commit 6515b69560
23 changed files with 382 additions and 68 deletions

View File

@@ -46,17 +46,18 @@ class MessageTemplates::HookExecutionService
contact.email
end
def csat_enabled_inbox?
# for now csat only available in web widget channel
return unless inbox.web_widget?
return unless inbox.csat_survey_enabled?
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 conversation.resolved?
return unless csat_enabled_inbox?
return unless csat_enabled_conversation?
# only send CSAT once in a conversation
return if conversation.messages.where(content_type: :input_csat).present?