Browse Source

Fixes #5260 - Overview is not refreshing.

Co-authored-by: Florian Liebe <fl@zammad.com>
Rolf Schmidt 8 months ago
parent
commit
744a909bae
3 changed files with 26 additions and 0 deletions
  1. 2 0
      lib/sessions.rb
  2. 1 0
      lib/sessions/client.rb
  3. 23 0
      spec/system/ticket/view_spec.rb

+ 2 - 0
lib/sessions.rb

@@ -512,6 +512,8 @@ returns
         thread_client(client_id, try_count, try_run_time, node_id)
       end
       raise "STOP thread_client for client #{node_id}.#{client_id} after #{try_run_max} tries"
+    ensure
+      ActiveSupport::CurrentAttributes.clear_all
     end
     log('debug', "/LOOP #{node_id}.#{client_id} - #{try_count}")
   end

+ 1 - 0
lib/sessions/client.rb

@@ -23,6 +23,7 @@ class Sessions::Client
     user_updated_at_last_run = nil
     loop_count               = 0
     loop do
+      ActiveSupport::CurrentAttributes.clear_all
 
       # check if session still exists
       return if !Sessions.session_exists?(@client_id)

+ 23 - 0
spec/system/ticket/view_spec.rb

@@ -508,4 +508,27 @@ RSpec.describe 'Ticket views', authenticated_as: :authenticate, type: :system do
       end
     end
   end
+
+  context 'Overview is not refreshing #5260', authenticated_as: :agent, sessions_jobs: true do
+    let(:agent)       { create(:agent, groups: Group.all) }
+    let(:ticket)      { Ticket.first }
+    let(:new_title_1) { SecureRandom.uuid }
+    let(:new_title_2) { SecureRandom.uuid }
+    let(:new_title_3) { SecureRandom.uuid }
+
+    before do
+      visit '#ticket/view/all_open'
+      ensure_websocket
+    end
+
+    it 'does refresh the ticket after the title has changed' do
+      expect(page).to have_text(ticket.title)
+      ticket.update(title: new_title_1)
+      expect(page).to have_text(ticket.title)
+      ticket.update(title: new_title_2)
+      expect(page).to have_text(ticket.title)
+      ticket.update(title: new_title_3)
+      expect(page).to have_text(ticket.title)
+    end
+  end
 end