[#792] Add confirmation emails for successful forum replies
This commit is contained in:
parent
7c7aca4f0c
commit
331ecb4c4f
|
@ -192,6 +192,7 @@ class MailHandler < ActionMailer::Base
|
||||||
reply.board = message.board
|
reply.board = message.board
|
||||||
message.children << reply
|
message.children << reply
|
||||||
add_attachments(reply)
|
add_attachments(reply)
|
||||||
|
Mailer.deliver_mail_handler_confirmation(message, user, reply.subject) if Setting.mail_handler_confirmation_on_success
|
||||||
reply
|
reply
|
||||||
else
|
else
|
||||||
logger.info "MailHandler: ignoring reply from [#{sender_email}] to a locked topic" if logger && logger.info
|
logger.info "MailHandler: ignoring reply from [#{sender_email}] to a locked topic" if logger && logger.info
|
||||||
|
|
|
@ -295,6 +295,9 @@ class Mailer < ActionMailer::Base
|
||||||
when object.is_a?(Journal)
|
when object.is_a?(Journal)
|
||||||
project = object.project.name
|
project = object.project.name
|
||||||
url = url_for(:controller => 'issues', :action => 'show', :id => object.issue.id)
|
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
|
else
|
||||||
project = ''
|
project = ''
|
||||||
url = ''
|
url = ''
|
||||||
|
|
|
@ -479,7 +479,17 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
context "#receive_message_reply" do
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue