From 1708f4a4c3f27e5bbbbb5818623dc1eb6688d2f0 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 3 Aug 2011 15:11:28 +0100 Subject: Log the reason why an incoming mail is routed to the holding pen, and display it to administrators. Closes #107. --- app/controllers/admin_request_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index d5bd4c4d6..a617b06df 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -275,7 +275,6 @@ class AdminRequestController < AdminController def show_raw_email @raw_email = RawEmail.find(params[:id]) - # For the holding pen, try to guess where it should be ... @holding_pen = false if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.mail.from_addrs.nil? && @raw_email.incoming_message.mail.from_addrs.size > 0) @@ -303,6 +302,10 @@ class AdminRequestController < AdminController for address in addresses @info_requests += InfoRequest.guess_by_incoming_email(address) end + + # 3. Give a reason why it's in the holding pen + last_event = @raw_email.incoming_message.info_request.get_last_event + @rejected_reason = last_event.params[:rejected_reason] end end -- cgit v1.2.3 From 99548c87d201871a150e395c334e07149651996a Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 8 Aug 2011 11:54:27 +0100 Subject: Guess holding pen emails based on having a correct hash and an incorrect id. Closes #117 --- app/controllers/admin_request_controller.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index a617b06df..2b471400b 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -293,15 +293,7 @@ class AdminRequestController < AdminController end # 2. Match the email address in the message without matching the hash - @info_requests = [] - addresses = - (@raw_email.incoming_message.mail.to || []) + - (@raw_email.incoming_message.mail.cc || []) + - (@raw_email.incoming_message.mail.envelope_to || []) - addresses.uniq! - for address in addresses - @info_requests += InfoRequest.guess_by_incoming_email(address) - end + @info_requests = InfoRequest.guess_by_incoming_email(@raw_email.incoming_message) # 3. Give a reason why it's in the holding pen last_event = @raw_email.incoming_message.info_request.get_last_event -- cgit v1.2.3 From e6fda87211f3c525c17b0d8a2c039192a6c18bb6 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 8 Aug 2011 16:36:38 +0100 Subject: allow admin to redeliver emails to closed requests. Fixes #116 --- app/controllers/admin_request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 2b471400b..b3fb1ce40 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -177,7 +177,7 @@ class AdminRequestController < AdminController raw_email_data = incoming_message.raw_email.data mail = TMail::Mail.parse(raw_email_data) mail.base64_decode - destination_request.receive(mail, raw_email_data) + destination_request.receive(mail, raw_email_data, true) incoming_message_id = incoming_message.id incoming_message.fully_destroy -- cgit v1.2.3 From 10e7ce5610731c073553072724c6ef7e44236781 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Thu, 11 Aug 2011 10:09:29 +0100 Subject: Show the rejected reason for the incoming message in question, not the most recent rejected reason for the info request in question. Fixes #129. --- app/controllers/admin_request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index b3fb1ce40..e5de4f8b7 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -296,7 +296,7 @@ class AdminRequestController < AdminController @info_requests = InfoRequest.guess_by_incoming_email(@raw_email.incoming_message) # 3. Give a reason why it's in the holding pen - last_event = @raw_email.incoming_message.info_request.get_last_event + last_event = InfoRequestEvent.find_by_incoming_message_id(@raw_email.incoming_message.id) @rejected_reason = last_event.params[:rejected_reason] end end -- cgit v1.2.3