[#792] Add confirmation emails for successful forum replies

This commit is contained in:
Eric Davis 2011-02-02 16:16:17 -08:00
parent 7c7aca4f0c
commit 331ecb4c4f
3 changed files with 15 additions and 1 deletions

View File

@ -192,6 +192,7 @@ class MailHandler < ActionMailer::Base
reply.board = message.board
message.children << reply
add_attachments(reply)
Mailer.deliver_mail_handler_confirmation(message, user, reply.subject) if Setting.mail_handler_confirmation_on_success
reply
else
logger.info "MailHandler: ignoring reply from [#{sender_email}] to a locked topic" if logger && logger.info

View File

@ -295,6 +295,9 @@ class Mailer < ActionMailer::Base
when object.is_a?(Journal)
project = object.project.name
url = url_for(:controller => 'issues', :action => 'show', :id => object.issue.id)
when object.class == Message
project = object.project.name
url = url_for(object.event_url)
else
project = ''
url = ''

View File

@ -479,7 +479,17 @@ class MailHandlerTest < ActiveSupport::TestCase
end
context "#receive_message_reply" do
should "deliver an email confirmation when configured"
should "deliver an email confirmation when configured" do
ActionMailer::Base.deliveries.clear
m = submit_email('message_reply.eml')
assert_equal 2, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
assert mail.subject.include?('[eCookbook]'), "Project name missing"
assert mail.subject.include?('Confirmation of email submission: Reply via email'), "Main subject missing"
assert mail.body.include?("/boards/1/topics/1"), "Link to message missing"
end
end
private