Bug: Fixed conversation reply mail issue when an attachment is sent (#655)
* When an attachment was sent in the reply mailer it was breaking due to the truncating function applied on the last message content. Here the content was empty and so it broke. * Fixed this breakage * Also addressed the issue that if the attachment was there the content was coming empty. With these changes, made the content to have a link to the attachment.
This commit is contained in:
@@ -20,7 +20,8 @@ class ConversationReplyMailer < ApplicationMailer
|
||||
|
||||
private
|
||||
|
||||
def mail_subject(last_message, trim_length = 30)
|
||||
"[##{@conversation.display_id}] #{last_message.content.truncate(trim_length)}"
|
||||
def mail_subject(last_message, trim_length = 50)
|
||||
subject_line = last_message&.content&.truncate(trim_length) || 'New messages on this conversation'
|
||||
"[##{@conversation.display_id}] #{subject_line}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,13 @@
|
||||
<td>
|
||||
<b><%= message.incoming? ? 'You' : message.user.name %></b>
|
||||
</td>
|
||||
<td>: <%= message.content %></td>
|
||||
<td>:
|
||||
<% if message.attachment %>
|
||||
attachment [<a href="<%= message.attachment.file_url %>" _target="blank">click here to view</a>]
|
||||
<% else %>
|
||||
<%= message.content %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user