From 8f0ca6b58d49afe70de5d9a44ba23171a0bab3da Mon Sep 17 00:00:00 2001 From: Francis Irving Date: Thu, 29 Oct 2009 19:00:04 +0000 Subject: Option to use message id to not duplicate incoming messages. --- app/models/info_request.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index a32aff1fb..7cee3fe1c 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -324,6 +324,23 @@ public end end + # Has this email already been received here? Based just on message id. + def already_received?(email, raw_email_data) + message_id = email.message_id + if message_id.nil? + raise "No message id for this message" + end + + for im in self.incoming_messages + other_message_id = im.mail.message_id + if message_id == other_message_id + return true + end + end + + return false + end + # A new incoming email to this request def receive(email, raw_email_data, override_stop_new_responses = false) if !override_stop_new_responses @@ -388,6 +405,7 @@ public RequestMailer.deliver_new_response(self, incoming_message) end + # An annotation (comment) is made def add_comment(body, user) comment = Comment.new -- cgit v1.2.3