Follow up 5f2181d8a3 - Fixes #3757 - escaped 'Set fixed' workflows don't refresh set values on active ticket sessions.

This commit is contained in:
Rolf Schmidt 2021-10-04 10:50:14 +02:00 committed by Thorsten Eckel
parent 03bcf66126
commit dd66c30d59
3 changed files with 72 additions and 2 deletions

View file

@ -200,10 +200,10 @@ class App.TicketZoom extends App.Controller
formMeta = data.form_meta
# on the following states we want to rerender the ticket:
# - if the object attribute configuration has changed (attribute values, restrictions, filters)
# - if the object attribute configuration has changed (attribute values, dependecies, filters)
# - if the user view has changed (agent/customer)
# - if the ticket permission has changed (read/write/full)
if @view && ( !_.isEqual(@formMeta, formMeta) || @view isnt view || @readable isnt readable || @changeable isnt changeable || @fullable isnt fullable )
if @view && ( !_.isEqual(@formMeta.configure_attributes, formMeta.configure_attributes) || !_.isEqual(@formMeta.dependencies, formMeta.dependencies) || !_.isEqual(@formMeta.filter, formMeta.filter) || @view isnt view || @readable isnt readable || @changeable isnt changeable || @fullable isnt fullable )
@renderDone = false
@view = view
@ -214,6 +214,7 @@ class App.TicketZoom extends App.Controller
# render page
@render(local)
App.Event.trigger('ui::ticket::load', data)
meta: =>

View file

@ -5,6 +5,13 @@
class Edit extends App.Controller
constructor: (params) ->
super
@controllerBind('ui::ticket::load', (data) =>
return if data.ticket_id.toString() isnt @ticket.id.toString()
@ticket = App.Ticket.find(@ticket.id)
@formMeta = data.form_meta
@render()
)
@render()
render: =>
@ -18,6 +25,9 @@ class Edit extends App.Controller
if !_.isEmpty(taskState)
defaults = _.extend(defaults, taskState)
# remove core workflow data because it should trigger a request to get data
# for the new ticket + eventually changed task state
@formMeta.core_workflow = undefined
if followUpPossible == 'new_ticket' && ticketState != 'closed' ||
followUpPossible != 'new_ticket' ||

View file

@ -2134,4 +2134,63 @@ RSpec.describe 'Ticket zoom', type: :system do
end
end
end
context 'Basic sidebar handling because of regressions in #3757' do
let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }
before do
visit "#ticket/zoom/#{ticket.id}"
end
it 'does show up the new priority' do
high_prio = Ticket::Priority.find_by(name: '3 high')
ticket.update(priority: high_prio)
wait(10, interval: 0.5).until { page.find("select[name='priority_id']").value == high_prio.id.to_s }
expect(page.find("select[name='priority_id']").value).to eq(high_prio.id.to_s)
end
it 'does show up the new state and pending time' do
pending_state = Ticket::State.find_by(name: 'pending reminder')
ticket.update(state: pending_state, pending_time: 1.day.from_now)
wait(10, interval: 0.5).until { page.find("select[name='state_id']").value == pending_state.id.to_s }
expect(page.find("select[name='state_id']").value).to eq(pending_state.id.to_s)
expect(page).to have_selector("div[data-name='pending_time']")
end
it 'does merge attributes with remote priority (ajax) and local state (user)' do
select 'closed', from: 'State'
high_prio = Ticket::Priority.find_by(name: '3 high')
closed_state = Ticket::State.find_by(name: 'closed')
ticket.update(priority: high_prio)
wait(10, interval: 0.5).until { page.find("select[name='priority_id']").value == high_prio.id.to_s }
expect(page.find("select[name='priority_id']").value).to eq(high_prio.id.to_s)
expect(page.find("select[name='state_id']").value).to eq(closed_state.id.to_s)
end
context 'when 2 users are in 2 different tickets' do
let(:ticket2) { create(:ticket, group: Group.find_by(name: 'Users')) }
let(:agent2) { create(:agent, password: 'test', groups: [Group.find_by(name: 'Users')]) }
before do
using_session(:second_browser) do
login(
username: agent2.login,
password: 'test',
)
visit "#ticket/zoom/#{ticket.id}"
visit "#ticket/zoom/#{ticket2.id}"
end
end
it 'does not make any changes to the second browser ticket' do
closed_state = Ticket::State.find_by(name: 'closed')
select 'closed', from: 'State'
find('.js-submit').click
using_session(:second_browser) do
sleep 3
expect(page.find("select[name='state_id']").value).not_to eq(closed_state.id.to_s)
end
end
end
end
end