From 6137a45214c39685b72a146b0989f8c82c12fbb9 Mon Sep 17 00:00:00 2001 From: Tejaswini Chile Date: Wed, 10 May 2023 06:09:09 +0530 Subject: [PATCH] chore: Update link in the reply summary email (#7024) Co-authored-by: Pranav Raj S --- app/models/conversation.rb | 4 ++++ .../reply_with_summary.html.erb | 22 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/models/conversation.rb b/app/models/conversation.rb index fa59e8d24..e01fb3863 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -195,6 +195,10 @@ class Conversation < ApplicationRecord messages.chat.last(5) end + def csat_survey_link + "#{ENV.fetch('FRONTEND_URL', nil)}/survey/responses/#{uuid}" + end + private def execute_after_update_commit_callbacks diff --git a/app/views/mailers/conversation_reply_mailer/reply_with_summary.html.erb b/app/views/mailers/conversation_reply_mailer/reply_with_summary.html.erb index 34665b777..c6cb77ad2 100644 --- a/app/views/mailers/conversation_reply_mailer/reply_with_summary.html.erb +++ b/app/views/mailers/conversation_reply_mailer/reply_with_summary.html.erb @@ -5,18 +5,26 @@ <% @messages.each do |message| %> - <%= message.incoming? ? 'You' : message.sender&.available_name || message.sender&.name %> + <%= message.incoming? ? 'You' : message.sender&.available_name || message.sender&.name || 'Bot' %> - - <% if message.content %> + + <% if (message.content_type == 'input_csat' && message.message_type == 'template') %> +

Click here to rate the conversation.

+ <% elsif message.content.present? %> <%= CommonMarker.render_html(message.content).html_safe %> <% end %> - <% if message.attachments %> - <% message.attachments.each do |attachment| %> - Attachment [Click here to view] - <% end %> + <% if message.attachments.count.positive? %> +

+ <% if message.content.present? %> +


+ <% end %> + This message contains <%= message.attachments.count > 1 ? 'attachments' : 'an attachment' %>. + <% message.attachments.each do |attachment| %> +
- View the attachment here. + <% end %> +

<% end %>