diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-04 11:13:09 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-04 11:13:09 +0100 |
commit | 10fac075c1403a0410fbb4571148f6b9261241b7 (patch) | |
tree | 983699e55e6d0b780e04f9a655a42ed71b6713c1 /app/models/info_request.rb | |
parent | 4310fa8df4c3e3bcd3c7ef5cfa7f23314ed9dce1 (diff) | |
parent | 3f306d3126e32cd64c2a691accd1af0a91c9aa48 (diff) |
Merge remote-tracking branch 'openaustralia_github/small_email_hash_refactor' into rails-3-develop
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 5d73fbca9..1602aaece 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -351,7 +351,10 @@ public # copying an email, and that doesn't matter) def InfoRequest.find_by_incoming_email(incoming_email) id, hash = InfoRequest._extract_id_hash_from_email(incoming_email) - return self.find_by_magic_email(id, hash) + if hash_from_id(id) == hash + # Not using find(id) because we don't exception raised if nothing found + find_by_id(id) + end end # Return list of info requests which *might* be right given email address @@ -913,24 +916,6 @@ public return Digest::SHA1.hexdigest(id.to_s + AlaveteliConfiguration::incoming_email_secret)[0,8] end - # Called by find_by_incoming_email - and used to be called by separate - # function for envelope from address, until we abandoned it. - def InfoRequest.find_by_magic_email(id, hash) - expected_hash = InfoRequest.hash_from_id(id) - #print "expected: " + expected_hash + "\nhash: " + hash + "\n" - if hash != expected_hash - return nil - else - begin - return self.find(id) - rescue ActiveRecord::RecordNotFound - # so error email is sent to admin, rather than the exception sending weird - # error to the public body. - return nil - end - end - end - # Used to find when event last changed def InfoRequest.last_event_time_clause(event_type=nil) event_type_clause = '' |