Fixes #4022 - Error “customer_id required” on Macro execution.

This commit is contained in:
Rolf Schmidt 2022-03-21 13:02:28 +01:00
parent 2d6149234d
commit 76d8a83f0f
2 changed files with 22 additions and 1 deletions

View file

@ -164,7 +164,7 @@ class App.Ticket extends App.Model
params.ticket[attributes[1]] = pendtil.toISOString() params.ticket[attributes[1]] = pendtil.toISOString()
# apply user changes # apply user changes
else if attributes[1] is 'owner_id' else if attributes[1] is 'owner_id' || attributes[1] is 'customer_id'
if content.pre_condition is 'current_user.id' if content.pre_condition is 'current_user.id'
params.ticket[attributes[1]] = App.Session.get('id') params.ticket[attributes[1]] = App.Session.get('id')
else else

View file

@ -2590,4 +2590,25 @@ RSpec.describe 'Ticket zoom', type: :system do
expect(page).to have_selector('.sidebar-content', text: 'mail001.box') expect(page).to have_selector('.sidebar-content', text: 'mail001.box')
end end
end end
describe 'Error “customer_id required” on Macro execution #4022', authenticated_as: :authenticate do
let(:ticket) { create(:ticket, group: Group.first) }
let(:macro) { create(:macro, perform: { 'ticket.customer_id'=>{ 'pre_condition' => 'current_user.id', 'value' => nil, 'value_completion' => '' } }) }
def authenticate
ticket && macro
true
end
before do
visit "#ticket/zoom/#{ticket.id}"
end
it 'does set the agent as customer via macro' do
click '.js-openDropdownMacro'
page.find(:macro, macro.id).click
expect(ticket.reload.customer_id).to eq(User.find_by(email: 'admin@example.com').id)
end
end
end end