From 6f5b58969b885cff3ff51c96dd7592cf444666e9 Mon Sep 17 00:00:00 2001 From: Kane York Date: Wed, 25 Jun 2014 17:01:23 -0700 Subject: [PATCH] Only give necessary context --- app/jobs/scheduled/poll_mailbox.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/jobs/scheduled/poll_mailbox.rb b/app/jobs/scheduled/poll_mailbox.rb index 01f210c4c..bf6ec7abc 100644 --- a/app/jobs/scheduled/poll_mailbox.rb +++ b/app/jobs/scheduled/poll_mailbox.rb @@ -23,8 +23,6 @@ module Jobs mail_string = mail.pop Email::Receiver.new(mail_string).process rescue => e - # inform the user about the rejection - message = Mail::Message.new(mail_string) message_template = nil case e when Email::Receiver::UserNotSufficientTrustLevelError @@ -44,12 +42,12 @@ module Jobs end 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")}") Email::Sender.new(client_message, message_template).send else - data = { limit_once_per: false, message_params: { from: message.from, source: message.body } } - Discourse.handle_exception(e, data) + Discourse.handle_exception(e, { context: "incoming email", mail: mail_string }) end ensure mail.delete