Improved References-Header follow up check.
This commit is contained in:
parent
52043bfdc5
commit
116a7a5718
2 changed files with 43 additions and 3 deletions
|
@ -54,11 +54,9 @@ module Channel::Filter::FollowUpCheck
|
||||||
end
|
end
|
||||||
if references != ''
|
if references != ''
|
||||||
message_ids = references.split(/\s+/)
|
message_ids = references.split(/\s+/)
|
||||||
sender_type_agent = Ticket::Article::Sender.lookup(name: 'Agent')
|
|
||||||
sender_type_system = Ticket::Article::Sender.lookup(name: 'System')
|
|
||||||
message_ids.each {|message_id|
|
message_ids.each {|message_id|
|
||||||
message_id_md5 = Digest::MD5.hexdigest(message_id)
|
message_id_md5 = Digest::MD5.hexdigest(message_id)
|
||||||
article = Ticket::Article.where(message_id_md5: message_id_md5, sender_id: [sender_type_agent.id, sender_type_system.id]).order('created_at DESC, id DESC').limit(1).first
|
article = Ticket::Article.where(message_id_md5: message_id_md5).order('created_at DESC, id DESC').limit(1).first
|
||||||
next if !article
|
next if !article
|
||||||
Rails.logger.debug "Follow up for '##{article.ticket.number}' in references."
|
Rails.logger.debug "Follow up for '##{article.ticket.number}' in references."
|
||||||
mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id
|
mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id
|
||||||
|
|
|
@ -127,6 +127,48 @@ no reference "
|
||||||
assert_not_equal(ticket.id, ticket_p.id)
|
assert_not_equal(ticket.id, ticket_p.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'process with follow up check with two external reference headers' do
|
||||||
|
|
||||||
|
setting_orig = Setting.get('postmaster_follow_up_search_in')
|
||||||
|
Setting.set('postmaster_follow_up_search_in', %w(body attachment references))
|
||||||
|
|
||||||
|
data1 = "From: me@example.com
|
||||||
|
To: z@example.com
|
||||||
|
Subject: test 123
|
||||||
|
Message-ID: <9d16181c-2db2-c6c1-ff7f-41f2da4e289a@linuxhotel.de>
|
||||||
|
|
||||||
|
test 123
|
||||||
|
"
|
||||||
|
ticket_p1, article_p1, user_p1 = Channel::EmailParser.new.process({}, data1)
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
data1 = "From: me@example.com
|
||||||
|
To: z@example.com
|
||||||
|
Subject: test 123
|
||||||
|
Message-ID: <9d16181c-2db2-c6c1-ff7f-41f2da4e289a@linuxhotel.de>
|
||||||
|
|
||||||
|
test 123
|
||||||
|
"
|
||||||
|
ticket_p2, article_p2, user_p2 = Channel::EmailParser.new.process({}, data1)
|
||||||
|
assert_not_equal(ticket_p1.id, ticket_p2.id)
|
||||||
|
|
||||||
|
data2 = "From: you@example.com
|
||||||
|
To: y@example.com
|
||||||
|
Subject: RE: test 123
|
||||||
|
Message-ID: <oknn9teOke2uqbFQdGj2umXUwTkqgu0CqWHkA6V4K8p@akmail>
|
||||||
|
References: <9d16181c-2db2-c6c1-ff7f-41f2da4e289a@linuxhotel.de>
|
||||||
|
|
||||||
|
test 123
|
||||||
|
"
|
||||||
|
ticket_p3, article_p3, user_p3 = Channel::EmailParser.new.process({}, data2)
|
||||||
|
|
||||||
|
assert_equal(ticket_p2.id, ticket_p3.id)
|
||||||
|
|
||||||
|
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
test 'process with follow up check - with auto responses and no T# in subject_build' do
|
test 'process with follow up check - with auto responses and no T# in subject_build' do
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
|
|
Loading…
Reference in a new issue