Feature #33002

Include attachments in news post notifications

Added by Виктор Воеводский 5 months ago. Updated 5 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Email notifications
Target version:4.2.0
Resolution:Fixed

Description

There are no files in news notifications. Can this be implemented as in Issue?

Issue.png (6.68 KB) Виктор Воеводский, 2020-02-13 20:47

33002-include-attachments-in-news-added-notifications.patch Magnifier (4.19 KB) Yuichi HARADA, 2020-02-18 06:57

news-notification-include-attachments.png (255 KB) Yuichi HARADA, 2020-02-18 07:22


Related issues

Related to Redmine - Feature #16006: Include attachments in forum post notifications Closed

Associated revisions

Revision 19528
Added by Go MAEDA 5 months ago

Include attachments in news post notifications (#33002).

Patch by Yuichi HARADA.

History

#1 Updated by Go MAEDA 5 months ago

  • Category changed from News to Email notifications

#2 Updated by Go MAEDA 5 months ago

  • Related to Feature #16006: Include attachments in forum post notifications added

#3 Updated by Yuichi HARADA 5 months ago

I included the attachments in the notifications when the news was added.

diff --git a/app/views/mailer/news_added.html.erb b/app/views/mailer/news_added.html.erb
index daf250adf..992321930 100644
--- a/app/views/mailer/news_added.html.erb
+++ b/app/views/mailer/news_added.html.erb
@@ -2,3 +2,11 @@
 <em><%= @news.author.name %></em>

 <%= textilizable(@news, :description, :only_path => false) %>
+
+<% if @news.attachments.any? -%>
+<fieldset class="attachments"><legend><%= l(:label_attachment_plural) %></legend>
+<% @news.attachments.each do |attachment| -%>
+  <%= link_to_attachment attachment, :download => true, :only_path => false %> (<%= number_to_human_size(attachment.filesize) %>)<br />
+<% end -%>
+</fieldset>
+<% end -%>
\ No newline at end of file
diff --git a/app/views/mailer/news_added.text.erb b/app/views/mailer/news_added.text.erb
index c8ae3035f..65e6a404f 100644
--- a/app/views/mailer/news_added.text.erb
+++ b/app/views/mailer/news_added.text.erb
@@ -3,3 +3,10 @@
 <%= @news.author.name %>

 <%= @news.description %>
+
+<% if @news.attachments.any? -%>
+---<%= l(:label_attachment_plural).ljust(37, '-') %>
+<% @news.attachments.each do |attachment| -%>
+<%= attachment.filename %> (<%= number_to_human_size(attachment.filesize) %>)
+<% end -%>
+<% end -%>
\ No newline at end of file

#4 Updated by Go MAEDA 5 months ago

  • Subject changed from News attachments in mail. to Include attachments in news post notifications
  • Target version set to 4.2.0

LGTM. Setting the target version to 4.2.0.

#5 Updated by Go MAEDA 5 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you.

Also available in: Atom PDF