Project

General

Profile

Actions

Patch #2724

closed

Display attachment names in email notifications

Added by Brad Beattie almost 16 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email notifications
Target version:
-
Start date:
2009-02-12
Due date:
% Done:

0%

Estimated time:

Description

If a ticket is created with an attachment, no such information is displayed in the email notification. The patch below adds such a line to email.

Index: app/models/attachment.rb
===================================================================
--- app/models/attachment.rb    (revision 2451)
+++ app/models/attachment.rb    (working copy)
@@ -118,6 +118,10 @@
     self.filename =~ /\.(patch|diff)$/i
   end

+  def to_s
+    self.filename
+  end
+  
 private
   def sanitize_filename(value)
     # get only the filename, not the whole path
Index: app/views/mailer/_issue_text_plain.rhtml
===================================================================
--- app/views/mailer/_issue_text_plain.rhtml    (revision 2451)
+++ app/views/mailer/_issue_text_plain.rhtml    (working copy)
@@ -7,6 +7,7 @@
 <%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
 <%=l(:field_category)%>: <%= issue.category %>
 <%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
+<% if issue.attachments.size > 0 %><li><%=l(:label_attachment)%>: <%= issue.attachments.join(", ") %></li><% end %>
 <% issue.custom_values.each do |c| %><%= c.custom_field.name %>: <%= show_value(c) %>
 <% end %>

Index: app/views/mailer/_issue_text_html.rhtml
===================================================================
--- app/views/mailer/_issue_text_html.rhtml    (revision 2451)
+++ app/views/mailer/_issue_text_html.rhtml    (working copy)
@@ -7,6 +7,7 @@
 <li><%=l(:field_assigned_to)%>: <%= issue.assigned_to %></li>
 <li><%=l(:field_category)%>: <%= issue.category %></li>
 <li><%=l(:field_fixed_version)%>: <%= issue.fixed_version %></li>
+<% if issue.attachments.size > 0 %><li><%=l(:label_attachment)%>: <%= issue.attachments.join(", ") %></li><% end %>
 <% issue.custom_values.each do |c| %>
   <li><%= c.custom_field.name %>: <%= show_value(c) %></li>
 <% end %>

Related issues

Related to Redmine - Feature #12293: Add links to attachments in new issue email notificationClosedJean-Philippe Lang

Actions
Actions #1

Updated by Eric Davis almost 16 years ago

  • Subject changed from Display attachments in email notifications to Display attachment names in email notifications
  • Status changed from New to 7
  • Assignee set to Eric Davis

Good suggestion. I see a few improvements I'd make

  1. Add test cases
  2. For the HTML version it would be nice to link to the filename so a user can just click the link to download the attachment
  3. Instead of a comma separated list, maybe separate each attachment with a line break or a li
  4. Add the attachment description if it's available

I'll see about integrating this.

(FYI: if you upload the patch with the extension .diff or .patch, we can download it and apply it directly. Plus we get some nice syntax highlighting for the code)

Actions #2

Updated by Brad Beattie almost 16 years ago

Eric Davis wrote:

(FYI: if you upload the patch with the extension .diff or .patch, we can download it and apply it directly. Plus we get some nice syntax highlighting for the code)

Aye aye, captain. I'll see to it in the future.

Actions #3

Updated by Jean-Philippe Lang almost 16 years ago

+1

Actions #4

Updated by Eric Davis about 14 years ago

  • Assignee deleted (Eric Davis)
Actions #5

Updated by Jean-Philippe Lang almost 12 years ago

  • Status changed from 7 to New

Assigned issue with no assignee back to New status.

Actions #6

Updated by Jean-Philippe Lang over 11 years ago

  • Status changed from New to Closed

Superseded by r11853.

Actions

Also available in: Atom PDF