Patch #16006

Forum post notification does not include attachments

Added by T. Hauptman almost 4 years ago. Updated almost 4 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email notifications
Target version:-

Description

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.

notify.patch Magnifier (1.04 KB) T. Hauptman, 2014-02-01 20:37


Related issues

Related to Redmine - Patch #1616: Allow email to create and reply to forum messages New 2008-07-10

History

#1 Updated by Toshi MARUYAMA almost 4 years ago

  • Category set to Email notifications

#2 Updated by Toshi MARUYAMA almost 4 years ago

  • Tracker changed from Patch to Defect

#3 Updated by Toshi MARUYAMA almost 4 years ago

  • Tracker changed from Defect to Patch

#4 Updated by Toshi MARUYAMA almost 4 years ago

  • Related to Patch #1616: Allow email to create and reply to forum messages added

Also available in: Atom PDF