Browse Source

Fixes #4094 - Tab behaviour does not show properly when doing a ticket update at the same time.

Rolf Schmidt 2 years ago
parent
commit
731bfbd268

+ 1 - 3
app/assets/javascripts/app/controllers/ticket_zoom/attribute_bar.coffee

@@ -18,8 +18,6 @@ class App.TicketZoomAttributeBar extends App.Controller
   constructor: ->
     super
 
-    @secondaryAction = @getAction()
-
     @subscribeId = App.Macro.subscribe(@checkMacroChanges)
     @render()
 
@@ -97,7 +95,7 @@ class App.TicketZoomAttributeBar extends App.Controller
       sharedDraftButtonShown: sharedDraftButtonShown
     ))
 
-    @setSecondaryAction(@secondaryAction, localeEl)
+    @setSecondaryAction(@getAction(), localeEl)
 
     if @ticket.currentView() is 'agent'
       @taskbarWatcher = new App.TaskbarWatcher(

+ 8 - 0
spec/system/ticket/zoom_spec.rb

@@ -1868,6 +1868,14 @@ RSpec.describe 'Ticket zoom', type: :system do
       expect(User.find_by(email: 'admin@example.com').preferences[:secondaryAction]).to eq('stayOnTab')
     end
 
+    it 'does show the correct tab state after update of the ticket (#4094)' do
+      select 'closed', from: 'State'
+      click '.js-attributeBar .dropup div'
+      click 'span[data-type=stayOnTab]'
+      click '.js-submit'
+      expect(page.find('.js-secondaryActionButtonLabel')).to have_text('Stay on tab')
+    end
+
     context 'Tab behaviour - Close tab on ticket close' do
       it 'does not close the tab without any action' do
         click '.js-submit'