Forum post notification does not include attachments
|Target version:||Candidate for next major release|
The send_notification is called on message creation, before attachments are added. In my case, I need links to attachments to be sent in the notification email.
My app/views/mailer/message_posted.text.erb do do this is:
<%= @message.content %> <% if @message.attachments.any? -%> ---<%= l(:label_attachment_plural).ljust(37, '-') %> <% @message.attachments.each do |attachment| -%> <%=attachment.filename%>: <%=send(:named_attachment_path, attachment, attachment.filename,:only_path=>false) %> (<%= number_to_human_size(attachment.filesize) %>) <% end -%> <% end -%> <%= @author.firstname + " " + @author.lastname + " - "+ @author.mail %>
If the forum message is created by an incoming email (with attachments) then no attachements are shown in outgoing notifications. If the forum message is created via the web form, the attachments are shown.
I fixed this by changing the send_notification trigger to after_commit. Patch attached.
#5 Updated by Yuichi HARADA 21 days ago
- File forum_notification_include_attachments.png added
- File 16006_forum_notification_include_attachments.patch added
T. Hauptman wrote:
I fixed this by changing the send_notification trigger to after_commit.
Already improved by source:trunk/app/models/message.rb@17588#L48 . However, the attachments are not included in forum post notification.
I created a patch to include attachments in forum post notification.