From 1c7278d8be4d94dda4b795339c8f856e7c5e5a6a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 6 Feb 2017 11:42:46 +0100 Subject: [PATCH] Fixed issue #740 - Unable to process emails if "Additional follow-up detection" was checked and unchecked again. --- app/models/channel/filter/follow_up_check.rb | 2 +- test/unit/email_process_follow_up_test.rb | 44 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/app/models/channel/filter/follow_up_check.rb b/app/models/channel/filter/follow_up_check.rb index 50346428e..7024b195b 100644 --- a/app/models/channel/filter/follow_up_check.rb +++ b/app/models/channel/filter/follow_up_check.rb @@ -14,7 +14,7 @@ module Channel::Filter::FollowUpCheck return true end - setting = Setting.get('postmaster_follow_up_search_in') + setting = Setting.get('postmaster_follow_up_search_in') || [] # get ticket# from body if setting.include?('body') diff --git a/test/unit/email_process_follow_up_test.rb b/test/unit/email_process_follow_up_test.rb index f7c12a2bb..b324a5545 100644 --- a/test/unit/email_process_follow_up_test.rb +++ b/test/unit/email_process_follow_up_test.rb @@ -104,6 +104,50 @@ no reference " ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2) assert_equal(ticket.id, ticket_p.id) + Setting.set('postmaster_follow_up_search_in', nil) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_subject) + assert_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_body) + assert_not_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_attachment) + assert_not_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references1) + assert_not_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2) + assert_not_equal(ticket.id, ticket_p.id) + + Setting.set('postmaster_follow_up_search_in', 'references') + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_subject) + assert_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_body) + assert_not_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_attachment) + assert_not_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references1) + assert_equal(ticket.id, ticket_p.id) + + travel 1.second + ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2) + assert_equal(ticket.id, ticket_p.id) + Setting.set('postmaster_follow_up_search_in', setting_orig) travel 1.second