aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin_request_controller.rb9
-rw-r--r--app/controllers/application_controller.rb11
-rw-r--r--app/controllers/general_controller.rb6
3 files changed, 8 insertions, 18 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 3e574b10f..1de63be59 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -207,8 +207,7 @@ class AdminRequestController < AdminController
end
raw_email_data = incoming_message.raw_email.data
- mail = TMail::Mail.parse(raw_email_data)
- mail.base64_decode
+ mail = MailHandler.mail_from_raw_email(raw_email_data)
destination_request.receive(mail, raw_email_data, true)
incoming_message_id = incoming_message.id
@@ -278,7 +277,7 @@ class AdminRequestController < AdminController
if params[:incoming_message_id]
incoming_message = IncomingMessage.find(params[:incoming_message_id])
- email = incoming_message.mail.from_addrs[0].address
+ email = incoming_message.from_address
name = incoming_message.safe_mail_from || info_request.public_body.name
else
email = info_request.public_body.request_email
@@ -313,12 +312,12 @@ class AdminRequestController < AdminController
@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)
+ if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.empty_from_field?)
@holding_pen = true
# 1. Use domain of email to try and guess which public body it
# is associated with, so we can display that.
- email = @raw_email.incoming_message.mail.from_addrs[0].spec
+ email = @raw_email.incoming_message.from_email
domain = PublicBody.extract_domain_from_email(email)
if domain.nil?
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b707ae878..3c94e1b47 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -117,17 +117,14 @@ class ApplicationController < ActionController::Base
# Override default error handler, for production sites.
def rescue_action_in_public(exception)
- # Call `set_view_paths` from the theme, if it exists.
+ # Looks for before_filters called something like `set_view_paths_{themename}`. These
+ # are set by the themes.
# Normally, this is called by the theme itself in a
# :before_filter, but when there's an error, this doesn't
# happen. By calling it here, we can ensure error pages are
# still styled according to the theme.
- begin
- set_view_paths
- rescue NameError => e
- if !(e.message =~ /undefined local variable or method `set_view_paths'/)
- raise
- end
+ ActionController::Base.before_filters.select{|f| f.to_s =~ /set_view_paths/}.each do |f|
+ self.send(f)
end
# Make sure expiry time for session is set (before_filters are
# otherwise missed by this override)
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 0cde238cd..3ba636e29 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -226,12 +226,6 @@ class GeneralController < ApplicationController
redirect_to request_url(info_request)
end
- # For debugging
- def fai_test
- sleep 10
- render :text => "awake\n"
- end
-
def custom_css
long_cache
@locale = self.locale_from_params()