chore: Update link in the reply summary email (#7024)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Tejaswini Chile 2023-05-10 06:09:09 +05:30 committed by GitHub
parent 5e0ce7793c
commit 6137a45214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View File

@ -195,6 +195,10 @@ class Conversation < ApplicationRecord
messages.chat.last(5) messages.chat.last(5)
end end
def csat_survey_link
"#{ENV.fetch('FRONTEND_URL', nil)}/survey/responses/#{uuid}"
end
private private
def execute_after_update_commit_callbacks def execute_after_update_commit_callbacks

View File

@ -5,18 +5,26 @@
<% @messages.each do |message| %> <% @messages.each do |message| %>
<tr> <tr>
<td> <td>
<b><%= message.incoming? ? 'You' : message.sender&.available_name || message.sender&.name %></b> <b><%= message.incoming? ? 'You' : message.sender&.available_name || message.sender&.name || 'Bot' %></b>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding: 10px 20px; margin: 5px 0 20px 0; background: #F2F3F7; border-radius: 10px; display: inline-block; font-family: 'Helvetica Neue',Tahoma,Arial,sans-serif; text-align: start; unicode-bidi: plaintext;"> <td style="padding: 0px 16px; margin: 4px 0 8px 0; background: #F5FAFF; border-radius: 5px; display: inline-block; font-family: 'Helvetica Neue',Tahoma,Arial,sans-serif; text-align: start; unicode-bidi: plaintext;">
<% if message.content %> <% if (message.content_type == 'input_csat' && message.message_type == 'template') %>
<p>Click <a href="<%= message.conversation.csat_survey_link %>" _target="blank">here</a> to rate the conversation.</p>
<% elsif message.content.present? %>
<%= CommonMarker.render_html(message.content).html_safe %> <%= CommonMarker.render_html(message.content).html_safe %>
<% end %> <% end %>
<% if message.attachments %> <% if message.attachments.count.positive? %>
<% message.attachments.each do |attachment| %> <p>
Attachment [<a href="<%= attachment.file_url %>" _target="blank">Click here to view</a>] <% if message.content.present? %>
<hr style="border: 0; border-bottom: 1px solid #AEC3D5;"/>
<% end %> <% end %>
This message contains <%= message.attachments.count > 1 ? 'attachments' : 'an attachment' %>.
<% message.attachments.each do |attachment| %>
<br />- View the attachment <a href="<%= attachment.file_url %>" _target="blank">here</a>.
<% end %>
</p>
<% end %> <% end %>
</td> </td>
</tr> </tr>