aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb2
-rwxr-xr-xapp/helpers/link_to_helper.rb2
-rw-r--r--app/mailers/request_mailer.rb8
-rw-r--r--app/models/info_request.rb34
-rw-r--r--app/views/admin_general/index.html.erb2
5 files changed, 25 insertions, 23 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index a09939509..ac92801b9 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -919,7 +919,7 @@ class RequestController < ApplicationController
@last_info_request_event_id = info_request.last_event_id_needing_description
@new_responses_count = info_request.events_needing_description.select {|i| i.event_type == 'response'}.size
# For send followup link at bottom
- @last_response = info_request.get_last_response
+ @last_response = info_request.get_last_public_response
end
def make_request_zip(info_request, file_path)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 5533402c5..8df28f350 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -53,7 +53,7 @@ module LinkToHelper
# Respond to request
def respond_to_last_url(info_request, options = {})
- last_response = info_request.get_last_response
+ last_response = info_request.get_last_public_response
if last_response.nil?
show_response_no_followup_url(options.merge(:id => info_request.id))
else
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 4dbce6738..13b3bc4a1 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -347,8 +347,8 @@ class RequestMailer < ApplicationMailer
:age_in_days => days_since)
for info_request in info_requests
- alert_event_id = info_request.get_last_response_event_id
- last_response_message = info_request.get_last_response
+ alert_event_id = info_request.get_last_public_response_event_id
+ last_response_message = info_request.get_last_public_response
if alert_event_id.nil?
raise "internal error, no last response while making alert new response reminder, request id " + info_request.id.to_s
end
@@ -373,8 +373,8 @@ class RequestMailer < ApplicationMailer
def self.alert_not_clarified_request()
info_requests = InfoRequest.find(:all, :conditions => [ "awaiting_description = ? and described_state = 'waiting_clarification' and info_requests.updated_at < ?", false, Time.now() - 3.days ], :include => [ :user ], :order => "info_requests.id" )
for info_request in info_requests
- alert_event_id = info_request.get_last_response_event_id
- last_response_message = info_request.get_last_response
+ alert_event_id = info_request.get_last_public_response_event_id
+ last_response_message = info_request.get_last_public_response
if alert_event_id.nil?
raise "internal error, no last response while making alert not clarified reminder, request id " + info_request.id.to_s
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index fe0c94056..847a57ef4 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -733,28 +733,30 @@ public
self.info_request_events.create!(:event_type => type, :params => params)
end
- def response_events
- self.info_request_events.select{|e| e.response?}
+ def public_response_events
+ self.info_request_events.select{|e| e.response? && e.incoming_message.all_can_view? }
end
- # The last response is the default one people might want to reply to
- def get_last_response_event_id
- get_last_response_event.id if get_last_response_event
+ # The last public response is the default one people might want to reply to
+ def get_last_public_response_event_id
+ get_last_public_response_event.id if get_last_public_response_event
end
- def get_last_response_event
- response_events.last
+
+ def get_last_public_response_event
+ public_response_events.last
end
- def get_last_response
- get_last_response_event.incoming_message if get_last_response_event
+
+ def get_last_public_response
+ get_last_public_response_event.incoming_message if get_last_public_response_event
end
- def outgoing_events
- info_request_events.select{|e| e.outgoing? }
+ def public_outgoing_events
+ info_request_events.select{|e| e.outgoing? && e.outgoing_message.all_can_view? }
end
- # The last outgoing message
- def get_last_outgoing_event
- outgoing_events.last
+ # The last public outgoing message
+ def get_last_public_outgoing_event
+ public_outgoing_events.last
end
# Text from the the initial request, for use in summary display
@@ -989,8 +991,8 @@ public
end
def is_old_unclassified?
- !is_external? && awaiting_description && url_title != 'holding_pen' && get_last_response_event &&
- Time.now > get_last_response_event.created_at + OLD_AGE_IN_DAYS
+ !is_external? && awaiting_description && url_title != 'holding_pen' && get_last_public_response_event &&
+ Time.now > get_last_public_response_event.created_at + OLD_AGE_IN_DAYS
end
# List of incoming messages to followup, by unique email
diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb
index b239a2b3f..976860fa7 100644
--- a/app/views/admin_general/index.html.erb
+++ b/app/views/admin_general/index.html.erb
@@ -164,7 +164,7 @@
<%= request_both_links(@request) %>
</td>
<td class="span2">
- <%=simple_date(@request.get_last_response_event.created_at)%>
+ <%=simple_date(@request.get_last_public_response_event.created_at)%>
</td>
</tr>
<% end %>