Fixes #3489 - mention in email body breaks email parsing.
This commit is contained in:
parent
32b30ced5e
commit
ae4c601d1c
2 changed files with 19 additions and 0 deletions
|
@ -336,6 +336,7 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
return if mention_user_ids.blank?
|
return if mention_user_ids.blank?
|
||||||
|
return if ApplicationHandleInfo.postmaster? && !MentionPolicy.new(updated_by, Mention.new).create?
|
||||||
raise "User #{updated_by_id} has no permission to mention other Users!" if !MentionPolicy.new(updated_by, Mention.new).create?
|
raise "User #{updated_by_id} has no permission to mention other Users!" if !MentionPolicy.new(updated_by, Mention.new).create?
|
||||||
|
|
||||||
user_ids = User.where(id: mention_user_ids).pluck(:id)
|
user_ids = User.where(id: mention_user_ids).pluck(:id)
|
||||||
|
|
|
@ -234,6 +234,24 @@ RSpec.describe Channel::EmailParser, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'Mentions:' do
|
||||||
|
let(:agent) { create(:agent) }
|
||||||
|
let(:raw_mail) { <<~RAW.chomp }
|
||||||
|
From: foo@bar.com
|
||||||
|
To: baz@qux.net
|
||||||
|
Subject: Foo
|
||||||
|
|
||||||
|
Lorem ipsum dolor <a data-mention-user-id=\"#{agent.id}\">agent</a>
|
||||||
|
RAW
|
||||||
|
|
||||||
|
it 'creates a ticket and article without mentions and no exception raised' do
|
||||||
|
expect { described_class.new.process({}, raw_mail) }
|
||||||
|
.to change(Ticket, :count).by(1)
|
||||||
|
.and change(Ticket::Article, :count).by_at_least(1)
|
||||||
|
.and not_change(Mention, :count)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'associating emails to existing tickets' do
|
describe 'associating emails to existing tickets' do
|
||||||
|
|
Loading…
Reference in a new issue