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:
parent
6c4e1fdaac
commit
0afa5c297f
2 changed files with 10 additions and 3 deletions
|
@ -20,7 +20,8 @@ class ConversationReplyMailer < ApplicationMailer
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def mail_subject(last_message, trim_length = 30)
|
def mail_subject(last_message, trim_length = 50)
|
||||||
"[##{@conversation.display_id}] #{last_message.content.truncate(trim_length)}"
|
subject_line = last_message&.content&.truncate(trim_length) || 'New messages on this conversation'
|
||||||
|
"[##{@conversation.display_id}] #{subject_line}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,13 @@
|
||||||
<td>
|
<td>
|
||||||
<b><%= message.incoming? ? 'You' : message.user.name %></b>
|
<b><%= message.incoming? ? 'You' : message.user.name %></b>
|
||||||
</td>
|
</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>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue