Fixed issue #686 - Follow up detection not working if ticket_hook_position "none" is used.
This commit is contained in:
parent
5548ef1df8
commit
1fab6d8acb
3 changed files with 60 additions and 23 deletions
|
@ -376,7 +376,7 @@ returns
|
||||||
do not raise an exception - e. g. if used by scheduler
|
do not raise an exception - e. g. if used by scheduler
|
||||||
|
|
||||||
parser = Channel::EmailParser.new
|
parser = Channel::EmailParser.new
|
||||||
ticket, article, user = parser.process(channel, email_raw_string, fakse)
|
ticket, article, user = parser.process(channel, email_raw_string, false)
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
# set ticket to open again
|
# set ticket to open again
|
||||||
if !mail[ 'x-zammad-ticket-followup-state'.to_sym ]
|
if !mail['x-zammad-ticket-followup-state'.to_sym] && !mail['x-zammad-ticket-followup-state_id'.to_sym]
|
||||||
if state_type.name != 'new' && !mail['x-zammad-out-of-office'.to_sym]
|
if state_type.name != 'new' && !mail['x-zammad-out-of-office'.to_sym]
|
||||||
ticket.state = Ticket::State.find_by(name: 'open')
|
ticket.state = Ticket::State.find_by(name: 'open')
|
||||||
ticket.save!
|
ticket.save!
|
||||||
|
|
|
@ -39,7 +39,7 @@ module Channel::Filter::FollowUpCheck
|
||||||
end
|
end
|
||||||
|
|
||||||
# get ticket# from references
|
# get ticket# from references
|
||||||
if setting.include?('references') || mail[ 'x-zammad-is-auto-response'.to_sym ] == true
|
if setting.include?('references') || (mail[ 'x-zammad-is-auto-response'.to_sym ] == true || Setting.get('ticket_hook_position') == 'none')
|
||||||
|
|
||||||
# get all references 'References' + 'In-Reply-To'
|
# get all references 'References' + 'In-Reply-To'
|
||||||
references = ''
|
references = ''
|
||||||
|
@ -66,7 +66,7 @@ module Channel::Filter::FollowUpCheck
|
||||||
end
|
end
|
||||||
|
|
||||||
# get ticket# from references current email has same subject as inital article
|
# get ticket# from references current email has same subject as inital article
|
||||||
if !mail[:subject].empty?
|
if mail[:subject].present?
|
||||||
|
|
||||||
# get all references 'References' + 'In-Reply-To'
|
# get all references 'References' + 'In-Reply-To'
|
||||||
references = ''
|
references = ''
|
||||||
|
|
|
@ -325,4 +325,41 @@ Some Text"
|
||||||
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'process with follow up check - with none ticket# in subject' do
|
||||||
|
|
||||||
|
setting_orig = Setting.get('postmaster_follow_up_search_in')
|
||||||
|
Setting.set('postmaster_follow_up_search_in', [])
|
||||||
|
ticket_hook_position_orig = Setting.get('ticket_hook_position')
|
||||||
|
Setting.set('ticket_hook_position', 'none')
|
||||||
|
|
||||||
|
subject = 'some title'
|
||||||
|
email_raw_string = "From: me@example.com
|
||||||
|
To: bob@example.com
|
||||||
|
Subject: #{subject}
|
||||||
|
Message-ID: <123456789-follow-up-test-ticket_hook_position-none@linuxhotel.de>
|
||||||
|
|
||||||
|
Some Text"
|
||||||
|
|
||||||
|
ticket_p1, article_1, user_1, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
|
ticket1 = Ticket.find(ticket_p1.id)
|
||||||
|
assert_equal(subject, ticket1.title)
|
||||||
|
|
||||||
|
# follow up possible because same subject
|
||||||
|
subject = 'new subject lalala'
|
||||||
|
email_raw_string = "From: bob@example.com
|
||||||
|
To: me@example.com
|
||||||
|
Subject: AW: #{subject}
|
||||||
|
Message-ID: <123456789-follow-up-test-ticket_hook_position-none-2@linuxhotel.de>
|
||||||
|
References: <123456789-follow-up-test-ticket_hook_position-none@linuxhotel.de>
|
||||||
|
|
||||||
|
Some Text"
|
||||||
|
|
||||||
|
ticket_p2, article_p2, user_p2, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
|
ticket2 = Ticket.find(ticket_p2.id)
|
||||||
|
assert_equal(ticket1.id, ticket2.id)
|
||||||
|
|
||||||
|
Setting.set('ticket_hook_position', ticket_hook_position_orig)
|
||||||
|
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue