aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/incoming_message.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-07-31 17:16:56 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-16 12:25:22 +0100
commitfee41e5045ebee47c12ea6f9d2e6a39ad8110cae (patch)
treed736a4f1878a92330db06b15d930e38e96736253 /app/models/incoming_message.rb
parent4e2c4501587b7bf59a2f639a4891581c681d553e (diff)
Add response_event helper
Add a convenience method for getting the 'response' event associated with an incoming message.
Diffstat (limited to 'app/models/incoming_message.rb')
-rw-r--r--app/models/incoming_message.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index fd7b226a6..bf05cb0d1 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -65,6 +65,12 @@ class IncomingMessage < ActiveRecord::Base
'application/zip' => 1,
}
+ # Given that there are in theory many info request events, a convenience method for
+ # getting the response event
+ def response_event
+ self.info_request_events.detect{ |e| e.event_type == 'response' }
+ end
+
# Return a cached structured mail object
def mail(force = nil)
if (!force.nil? || @mail.nil?) && !self.raw_email.nil?