aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-06-04 12:10:50 +0100
committerLouise Crow <louise.crow@gmail.com>2013-06-04 12:10:50 +0100
commitcc1ff2db2899bcedd0a44ed1815034b91d3f528e (patch)
tree1d6639ca9267bf851af226674209a992ed7db1ae /app/models/info_request.rb
parentf6bb0e5d33ceb5beb80f9561b77c716a04f574a2 (diff)
parent8c5a1ba9ed8a3d30564a178926a2729b9e9931d7 (diff)
Merge remote-tracking branch 'openaustralia_github/more_info_on_report_request' into rails-3-develop
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 553bb2436..aaf171c4c 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -108,6 +108,12 @@ class InfoRequest < ActiveRecord::Base
states
end
+ # Possible reasons that a request could be reported for administrator attention
+ def report_reasons
+ ["Contains defamatory material", "Not a valid request", "Request for personal information",
+ "Contains personal information", "Vexatious", "Other"]
+ end
+
def must_be_valid_state
errors.add(:described_state, "is not a valid state") if
!InfoRequest.enumerate_states.include? described_state
@@ -543,6 +549,15 @@ public
['requires_admin', 'error_message', 'attention_requested'].include?(described_state)
end
+ # Report this request for administrator attention
+ def report!(reason, message, user)
+ ActiveRecord::Base.transaction do
+ set_described_state('attention_requested', user, "Reason: #{reason}\n\n#{message}")
+ self.attention_requested = true # tells us if attention has ever been requested
+ save!
+ end
+ end
+
# change status, including for last event for later historical purposes
def set_described_state(new_state, set_by = nil, message = "")
old_described_state = described_state