Fixes #3894 - Follow-up detection does not work for the body of plain text mails.
This commit is contained in:
parent
7279cb88b5
commit
927ecff993
2 changed files with 18 additions and 1 deletions
|
@ -18,7 +18,10 @@ module Channel::Filter::FollowUpCheck
|
|||
|
||||
# get ticket# from body
|
||||
if setting.include?('body')
|
||||
ticket = Ticket::Number.check(mail[:body].html2text)
|
||||
body = mail[:body]
|
||||
body = body.html2text if mail[:content_type] == 'text/html'
|
||||
|
||||
ticket = Ticket::Number.check(body)
|
||||
if ticket
|
||||
Rails.logger.debug { "Follow-up for '##{ticket.number}' in body." }
|
||||
mail[:'x-zammad-ticket-id'] = ticket.id
|
||||
|
|
|
@ -632,6 +632,20 @@ RSpec.describe Channel::EmailParser, type: :model do
|
|||
include_examples 'adds message to ticket'
|
||||
end
|
||||
|
||||
context 'in visible text with a linebreak' do
|
||||
let(:raw_mail) { <<~RAW.chomp }
|
||||
From: me@example.com
|
||||
To: customer@example.com
|
||||
Subject: no reference
|
||||
|
||||
Lorem ipsum dolor #{ticket_ref}
|
||||
consetetur sadipscing elitr
|
||||
sed diam nonumy eirmod
|
||||
RAW
|
||||
|
||||
include_examples 'adds message to ticket'
|
||||
end
|
||||
|
||||
context 'as part of a larger word' do
|
||||
let(:ticket_ref) { "Foo#{Setting.get('ticket_hook')}#{Setting.get('ticket_hook_divider')}#{ticket.number}bar" }
|
||||
|
||||
|
|
Loading…
Reference in a new issue