Fixes #2769 - Wrong Variable-Reference for Tags (Trigger, Scheduler).
This commit is contained in:
parent
37d7528221
commit
396ed5d9f4
2 changed files with 30 additions and 0 deletions
|
@ -47,6 +47,7 @@ examples how to use
|
||||||
# aliases
|
# aliases
|
||||||
map = {
|
map = {
|
||||||
'article.body' => 'article.body_as_text_with_quote.text2html',
|
'article.body' => 'article.body_as_text_with_quote.text2html',
|
||||||
|
'ticket.tags' => 'ticket.tag_list',
|
||||||
}
|
}
|
||||||
if map[key]
|
if map[key]
|
||||||
key = map[key]
|
key = map[key]
|
||||||
|
@ -176,6 +177,7 @@ examples how to use
|
||||||
end
|
end
|
||||||
|
|
||||||
def escaping(key, escape)
|
def escaping(key, escape)
|
||||||
|
return escaping(key.join(', '), escape) if key.respond_to?(:join)
|
||||||
return key if escape == false
|
return key if escape == false
|
||||||
return key if escape.nil? && !@escape
|
return key if escape.nil? && !@escape
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,34 @@ RSpec.describe Trigger, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when ticket has tags' do
|
||||||
|
let(:tag1) { create(:'tag/item', name: 't1') }
|
||||||
|
let(:tag2) { create(:'tag/item', name: 't2') }
|
||||||
|
let(:tag3) { create(:'tag/item', name: 't3') }
|
||||||
|
let!(:ticket) do
|
||||||
|
ticket = create(:ticket)
|
||||||
|
create(:tag, o: ticket, tag_item: tag1)
|
||||||
|
create(:tag, o: ticket, tag_item: tag2)
|
||||||
|
create(:tag, o: ticket, tag_item: tag3)
|
||||||
|
ticket
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:perform) do
|
||||||
|
{
|
||||||
|
'notification.email' => {
|
||||||
|
'recipient' => 'ticket_customer',
|
||||||
|
'subject' => 'foo',
|
||||||
|
'body' => 'some body with #{ticket.tags}', # rubocop:disable Lint/InterpolationCheck
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'fires body with replaced tags' do
|
||||||
|
Observer::Transaction.commit
|
||||||
|
expect(Ticket::Article.last.body).to eq('some body with t1, t2, t3')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when ticket is created via Channel::EmailParser.process' do
|
context 'when ticket is created via Channel::EmailParser.process' do
|
||||||
before { create(:email_address, groups: [Group.first]) }
|
before { create(:email_address, groups: [Group.first]) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue