Patch #16006

Forum post notification does not include attachments

Added by T. Hauptman almost 6 years ago. Updated 20 days ago.

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

0%

Category:Email notifications
Target version:Candidate for next major release

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

forum_notification_include_attachments.png (200 KB) Yuichi HARADA, 2019-10-29 06:30

16006_forum_notification_include_attachments.patch Magnifier (3.08 KB) Yuichi HARADA, 2019-10-29 06:35


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 over 5 years ago

  • Category set to Email notifications

#2 Updated by Toshi MARUYAMA over 5 years ago

  • Tracker changed from Patch to Defect

#3 Updated by Toshi MARUYAMA over 5 years ago

  • Tracker changed from Defect to Patch

#4 Updated by Toshi MARUYAMA over 5 years ago

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

#5 Updated by Yuichi HARADA 21 days ago

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.

#6 Updated by Go MAEDA 20 days ago

  • Target version set to Candidate for next major release

Also available in: Atom PDF