diff options
author | louise <louise> | 2009-04-06 10:58:03 +0000 |
---|---|---|
committer | louise <louise> | 2009-04-06 10:58:03 +0000 |
commit | de4645ca59fe224d7f526b626444c6209ad0cb1b (patch) | |
tree | eb9e971f65884b67c88dace012cae0d882de4b3d /app/models/info_request.rb | |
parent | ea8b613191aa95cbb2a8c51b71981e3801af4712 (diff) |
Added methods to InfoRequest for figuring out if a user is the real owner of the request (not just an admin owner) and if the request needs admin
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index a7ff58c28..bc7247806 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.180 2009-04-06 08:34:35 louise Exp $ +# $Id: info_request.rb,v 1.181 2009-04-06 10:58:03 louise Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -330,6 +330,11 @@ public return ['requires_admin', 'error_message'] end + def requires_admin? + return true if InfoRequest.requires_admin_states.include?(described_state) + return false + end + # change status, including for last event for later historical purposes def set_described_state(new_state) ActiveRecord::Base.transaction do @@ -343,7 +348,7 @@ public self.calculate_event_states - if InfoRequest.requires_admin_states.include?(new_state) + if self.requires_admin? RequestMailer.deliver_requires_admin(self) end end @@ -711,6 +716,11 @@ public def is_owning_user?(user) !user.nil? && (user.id == user_id || user.owns_every_request?) end + + def is_real_owning_user?(user) + !user.nil? && (user.id == user_id) + end + end |