Fixes #3801 - Remote change of the group id does show it falsly as user change and not render the new value to the ticket.
This commit is contained in:
parent
dd30b18285
commit
3cf7b79edc
3 changed files with 42 additions and 34 deletions
|
@ -641,6 +641,7 @@ class App.TicketZoom extends App.Controller
|
||||||
# update changes in ui
|
# update changes in ui
|
||||||
currentStore = @currentStore()
|
currentStore = @currentStore()
|
||||||
modelDiff = @formDiff(currentParams, currentStore)
|
modelDiff = @formDiff(currentParams, currentStore)
|
||||||
|
return if _.isEmpty(modelDiff)
|
||||||
|
|
||||||
# set followup state if needed
|
# set followup state if needed
|
||||||
@setDefaultFollowUpState(modelDiff, currentStore)
|
@setDefaultFollowUpState(modelDiff, currentStore)
|
||||||
|
@ -735,6 +736,14 @@ class App.TicketZoom extends App.Controller
|
||||||
|
|
||||||
# do not compare null or undefined value
|
# do not compare null or undefined value
|
||||||
if currentStore.ticket
|
if currentStore.ticket
|
||||||
|
|
||||||
|
# make sure that the compared state is same in local storage and
|
||||||
|
# rendered html. Else we could have race conditions of data
|
||||||
|
# which is not rendered yet
|
||||||
|
renderedUpdatedAt = @el.find('.edit').attr('data-ticket-updated-at')
|
||||||
|
return if !renderedUpdatedAt
|
||||||
|
return if currentStore.ticket.updated_at.toString() isnt renderedUpdatedAt
|
||||||
|
|
||||||
for key, value of currentStore.ticket
|
for key, value of currentStore.ticket
|
||||||
if value is null || value is undefined
|
if value is null || value is undefined
|
||||||
currentStore.ticket[key] = ''
|
currentStore.ticket[key] = ''
|
||||||
|
|
|
@ -29,9 +29,15 @@ class Edit extends App.Controller
|
||||||
# for the new ticket + eventually changed task state
|
# for the new ticket + eventually changed task state
|
||||||
@formMeta.core_workflow = undefined
|
@formMeta.core_workflow = undefined
|
||||||
|
|
||||||
if followUpPossible == 'new_ticket' && ticketState != 'closed' ||
|
editable = @ticket.editable()
|
||||||
followUpPossible != 'new_ticket' ||
|
if followUpPossible == 'new_ticket' && ticketState != 'closed' || followUpPossible != 'new_ticket' || @permissionCheck('admin') || @ticket.currentView() is 'agent'
|
||||||
@permissionCheck('admin') || @ticket.currentView() is 'agent'
|
editable = !editable
|
||||||
|
|
||||||
|
# reset updated_at for the sidbar because we render a new state
|
||||||
|
# it is used to compare the ticket with the rendered data later
|
||||||
|
# and needed to prevent race conditions
|
||||||
|
@el.removeAttr('data-ticket-updated-at')
|
||||||
|
|
||||||
@controllerFormSidebarTicket = new App.ControllerForm(
|
@controllerFormSidebarTicket = new App.ControllerForm(
|
||||||
elReplace: @el
|
elReplace: @el
|
||||||
model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes }
|
model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes }
|
||||||
|
@ -40,23 +46,7 @@ class Edit extends App.Controller
|
||||||
filter: @formMeta.filter
|
filter: @formMeta.filter
|
||||||
formMeta: @formMeta
|
formMeta: @formMeta
|
||||||
params: defaults
|
params: defaults
|
||||||
isDisabled: !@ticket.editable()
|
isDisabled: editable
|
||||||
taskKey: @taskKey
|
|
||||||
core_workflow: {
|
|
||||||
callbacks: [@markForm]
|
|
||||||
}
|
|
||||||
#bookmarkable: true
|
|
||||||
)
|
|
||||||
else
|
|
||||||
@controllerFormSidebarTicket = new App.ControllerForm(
|
|
||||||
elReplace: @el
|
|
||||||
model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes }
|
|
||||||
screen: 'edit'
|
|
||||||
handlersConfig: handlers
|
|
||||||
filter: @formMeta.filter
|
|
||||||
formMeta: @formMeta
|
|
||||||
params: defaults
|
|
||||||
isDisabled: @ticket.editable()
|
|
||||||
taskKey: @taskKey
|
taskKey: @taskKey
|
||||||
core_workflow: {
|
core_workflow: {
|
||||||
callbacks: [@markForm]
|
callbacks: [@markForm]
|
||||||
|
@ -64,6 +54,8 @@ class Edit extends App.Controller
|
||||||
#bookmarkable: true
|
#bookmarkable: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# set updated_at for the sidbar because we render a new state
|
||||||
|
@el.attr('data-ticket-updated-at', defaults.updated_at)
|
||||||
@markForm(true)
|
@markForm(true)
|
||||||
|
|
||||||
return if @resetBind
|
return if @resetBind
|
||||||
|
|
|
@ -2149,6 +2149,13 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
expect(page.find("select[name='priority_id']").value).to eq(high_prio.id.to_s)
|
expect(page.find("select[name='priority_id']").value).to eq(high_prio.id.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does show up the new group (different case because it will also trigger a full rerender because of potential permission changes)' do
|
||||||
|
group = Group.find_by(name: 'some group1')
|
||||||
|
ticket.update(group: group)
|
||||||
|
wait(10, interval: 0.5).until { page.find("select[name='group_id']").value == group.id.to_s }
|
||||||
|
expect(page.find("select[name='group_id']").value).to eq(group.id.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
it 'does show up the new state and pending time' do
|
it 'does show up the new state and pending time' do
|
||||||
pending_state = Ticket::State.find_by(name: 'pending reminder')
|
pending_state = Ticket::State.find_by(name: 'pending reminder')
|
||||||
ticket.update(state: pending_state, pending_time: 1.day.from_now)
|
ticket.update(state: pending_state, pending_time: 1.day.from_now)
|
||||||
|
|
Loading…
Reference in a new issue