Skip to content

Commit

Permalink
chore: Update link in the reply summary email (chatwoot#7024)
Browse files Browse the repository at this point in the history
Co-authored-by: Pranav Raj S <[email protected]>
  • Loading branch information
tejaswinichile and pranavrajs authored May 10, 2023
1 parent 5e0ce77 commit 6137a45
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions app/models/conversation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ def recent_messages
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@
<% @messages.each do |message| %>
<tr>
<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>
</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;">
<% if message.content %>
<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_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 %>
<% end %>
<% if message.attachments %>
<% message.attachments.each do |attachment| %>
Attachment [<a href="<%= attachment.file_url %>" _target="blank">Click here to view</a>]
<% end %>
<% if message.attachments.count.positive? %>
<p>
<% if message.content.present? %>
<hr style="border: 0; border-bottom: 1px solid #AEC3D5;"/>
<% 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 %>
</td>
</tr>
Expand Down

0 comments on commit 6137a45

Please sign in to comment.