Feature #16006 » 16006_forum_notification_include_attachments.patch
| app/views/mailer/message_posted.html.erb | ||
|---|---|---|
|
<em><%= @message.author %></em>
|
||
|
<%= textilizable(@message, :content, :only_path => false) %>
|
||
|
<% if @message.attachments.any? -%>
|
||
|
<fieldset class="attachments"><legend><%= l(:label_attachment_plural) %></legend>
|
||
|
<% @message.attachments.each do |attachment| -%>
|
||
|
<%= link_to_attachment attachment, :download => true, :only_path => false %> (<%= number_to_human_size(attachment.filesize) %>)<br />
|
||
|
<% end -%>
|
||
|
</fieldset>
|
||
|
<% end -%>
|
||
| app/views/mailer/message_posted.text.erb | ||
|---|---|---|
|
<%= @message.author %>
|
||
|
<%= @message.content %>
|
||
|
<% if @message.attachments.any? -%>
|
||
|
---<%= l(:label_attachment_plural).ljust(37, '-') %>
|
||
|
<% @message.attachments.each do |attachment| -%>
|
||
|
<%= attachment.filename %> (<%= number_to_human_size(attachment.filesize) %>)
|
||
|
<% end -%>
|
||
|
<% end -%>
|
||
| test/unit/mailer_test.rb | ||
|---|---|---|
|
def test_message_posted_message_id
|
||
|
message = Message.find(1)
|
||
|
attachment = message.attachments.first
|
||
|
Mailer.deliver_message_posted(message)
|
||
|
mail = last_email
|
||
|
uid = destination_user(mail).id
|
||
| ... | ... | |
|
assert_select "a[href=?]",
|
||
|
"http://localhost:3000/boards/#{message.board.id}/topics/#{message.id}",
|
||
|
:text => message.subject
|
||
|
# link to the attachments download
|
||
|
assert_select 'fieldset.attachments' do
|
||
|
assert_select 'a[href=?]',
|
||
|
"http://localhost:3000/attachments/download/#{attachment.id}/#{attachment.filename}",
|
||
|
:text => attachment.filename
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
def test_reply_posted_message_id
|
||
|
set_tmp_attachments_directory
|
||
|
message = Message.find(3)
|
||
|
attachment = Attachment.generate!(
|
||
|
:container => message,
|
||
|
:file => uploaded_test_file('testfile.txt', 'text/plain')
|
||
|
)
|
||
|
Mailer.deliver_message_posted(message)
|
||
|
mail = last_email
|
||
|
uid = destination_user(mail).id
|
||
| ... | ... | |
|
assert_select "a[href=?]",
|
||
|
"http://localhost:3000/boards/#{message.board.id}/topics/#{message.root.id}?r=#{message.id}#message-#{message.id}",
|
||
|
:text => message.subject
|
||
|
# link to the attachments download
|
||
|
assert_select 'fieldset.attachments' do
|
||
|
assert_select 'a[href=?]',
|
||
|
"http://localhost:3000/attachments/download/#{attachment.id}/testfile.txt",
|
||
|
:text => 'testfile.txt'
|
||
|
end
|
||
|
end
|
||
|
end
|
||