Fixed creation of article.message_id_md5 right after generating message_id.

This commit is contained in:
Martin Edenhofer 2015-08-30 22:15:23 +02:00
parent 618a1cb0db
commit 4bd1f8ebf1
2 changed files with 10 additions and 7 deletions

View file

@ -30,6 +30,9 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
fqdn = Setting.get('fqdn')
record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999_999).to_s() + '@' + fqdn + '>'
# generate message_id_md5
record.check_message_id_md5
# set sender
email_address = ticket.group.email_address
if !email_address

View file

@ -30,6 +30,13 @@ class Ticket::Article < ApplicationModel
preferences: true,
}
# fillup md5 of message id to search easier on very long message ids
def check_message_id_md5
return if !message_id
return if message_id_md5
self.message_id_md5 = Digest::MD5.hexdigest(message_id.to_s)
end
private
# strip not wanted chars
@ -38,13 +45,6 @@ class Ticket::Article < ApplicationModel
subject.gsub!(/\s|\t|\r/, ' ')
end
# fillup md5 of message id to search easier on very long message ids
def check_message_id_md5
return if !message_id
return if message_id_md5
self.message_id_md5 = Digest::MD5.hexdigest(message_id.to_s)
end
class Flag < ApplicationModel
end