From 4075d5a70a6e08c1d55e97dbfc13fda4a2faaf84 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Tue, 13 Dec 2011 17:27:39 +0000 Subject: Further improvements to attachment caching --- app/controllers/request_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 1801648ca..f7d870b4f 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -690,7 +690,6 @@ class RequestController < ApplicationController # check permissions raise "internal error, pre-auth filter should have caught this" if !@info_request.user_can_view?(authenticated_user) - @attachment = IncomingMessage.get_attachment_by_url_part_number(@incoming_message.get_attachments_for_display, @part_number) raise ActiveRecord::RecordNotFound.new("attachment not found part number " + @part_number.to_s + " incoming_message " + @incoming_message.id.to_s) if @attachment.nil? @@ -713,6 +712,7 @@ class RequestController < ApplicationController :email => _("Then you can upload an FOI response. "), :email_subject => _("Confirm your account on {{site_name}}",:site_name=>site_name) } + if !authenticated?(@reason_params) return end @@ -754,6 +754,7 @@ class RequestController < ApplicationController def search_typeahead # Since acts_as_xapian doesn't support the Partial match flag, we work around it # by making the last work a wildcard, which is quite the same + query = params[:q] + '*' query = query.split(' ').join(' OR ') # XXX: HACK for OR instead of default AND! -- cgit v1.2.3 From 757e5cb8a4fc25ddacde849747da2f3e41dd7e73 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 21 Dec 2011 15:46:06 +0000 Subject: Ensure we only parse emails when needed by referring to a new last_parsed field on incoming_messages. Currently mails are always parsed just-in-time, but could be parsed as a queue in the future. --- app/controllers/request_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers/request_controller.rb') diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index a7558acf0..dad5e81cd 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -676,6 +676,7 @@ class RequestController < ApplicationController # Internal function def get_attachment_internal(html_conversion) @incoming_message = IncomingMessage.find(params[:incoming_message_id]) + @incoming_message.parse_raw_email! @info_request = @incoming_message.info_request if @incoming_message.info_request_id != params[:id].to_i raise sprintf("Incoming message %d does not belong to request %d", @incoming_message.info_request_id, params[:id]) -- cgit v1.2.3