diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/info_request.rb | 10 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 59eade8fd..aa0471cdb 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -23,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.193 2009-06-16 17:28:17 francis Exp $ +# $Id: info_request.rb,v 1.194 2009-06-23 13:52:26 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -67,6 +67,7 @@ class InfoRequest < ActiveRecord::Base validates_inclusion_of :prominence, :in => [ 'normal', 'backpage', + 'hidden' ] validates_inclusion_of :law_used, :in => [ @@ -816,6 +817,13 @@ public !user.nil? && (user.id == user_id || user.owns_every_request?) end + def user_can_view?(user) + return self.prominence != 'hidden' + # || self.is_owning_user?(user) # XXX this doesn't work, as have to + # mess with caching of HTML versions - need to change from using + # caches_pages in the request controller first. + end + # XXX to be called from a cron job later def self.stop_new_responses_on_old_requests # 6 months since last change to request, only allow new incoming messages from authority domains diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index ef1a71d4a..4299e0553 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.82 2009-04-23 13:32:21 tony Exp $ +# $Id: info_request_event.rb,v 1.83 2009-06-23 13:52:26 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -154,7 +154,7 @@ class InfoRequestEvent < ActiveRecord::Base end def indexed_by_search if ['sent', 'followup_sent', 'response', 'comment'].include?(self.event_type) - if self.info_request.prominence == 'backpage' + if self.info_request.prominence == 'backpage' || self.info_request.prominence == 'hidden' return false end if self.event_type == 'comment' && !self.comment.visible |