mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
Merge pull request #2473 from riking/patch-1
Only give necessary context
This commit is contained in:
commit
2bf22e8475
1 changed files with 3 additions and 5 deletions
|
@ -23,8 +23,6 @@ module Jobs
|
||||||
mail_string = mail.pop
|
mail_string = mail.pop
|
||||||
Email::Receiver.new(mail_string).process
|
Email::Receiver.new(mail_string).process
|
||||||
rescue => e
|
rescue => e
|
||||||
# inform the user about the rejection
|
|
||||||
message = Mail::Message.new(mail_string)
|
|
||||||
message_template = nil
|
message_template = nil
|
||||||
case e
|
case e
|
||||||
when Email::Receiver::UserNotSufficientTrustLevelError
|
when Email::Receiver::UserNotSufficientTrustLevelError
|
||||||
|
@ -44,12 +42,12 @@ module Jobs
|
||||||
end
|
end
|
||||||
|
|
||||||
if message_template
|
if message_template
|
||||||
# Send message to the user
|
# inform the user about the rejection
|
||||||
|
message = Mail::Message.new(mail_string)
|
||||||
client_message = RejectionMailer.send_rejection(message.from, message.body, message_template.to_s, "#{e.message}\n\n#{e.backtrace.join("\n")}")
|
client_message = RejectionMailer.send_rejection(message.from, message.body, message_template.to_s, "#{e.message}\n\n#{e.backtrace.join("\n")}")
|
||||||
Email::Sender.new(client_message, message_template).send
|
Email::Sender.new(client_message, message_template).send
|
||||||
else
|
else
|
||||||
data = { limit_once_per: false, message_params: { from: message.from, source: message.body } }
|
Discourse.handle_exception(e, { context: "incoming email", mail: mail_string })
|
||||||
Discourse.handle_exception(e, data)
|
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
mail.delete
|
mail.delete
|
||||||
|
|
Loading…
Reference in a new issue