Browse Source

Fixes #2471 - Chat can't be closed after timeout.

Rolf Schmidt 3 years ago
parent
commit
3f48c222b5

+ 3 - 5
public/assets/chat/chat-no-jquery.coffee

@@ -1097,16 +1097,14 @@ do(window) ->
         return
       if @initDelayId
         clearTimeout(@initDelayId)
-      if !@sessionId
-        @log.debug 'can\'t close widget without sessionId'
-        return
+      if @sessionId
+        @log.debug 'session close before widget close'
+        @sessionClose()
 
       @log.debug 'close widget'
 
       event.stopPropagation() if event
 
-      @sessionClose()
-
       if @isFullscreen
         @enableScrollOnRoot()
 

+ 3 - 4
public/assets/chat/chat-no-jquery.js

@@ -1437,15 +1437,14 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
       if (this.initDelayId) {
         clearTimeout(this.initDelayId);
       }
-      if (!this.sessionId) {
-        this.log.debug('can\'t close widget without sessionId');
-        return;
+      if (this.sessionId) {
+        this.log.debug('session close before widget close');
+        this.sessionClose();
       }
       this.log.debug('close widget');
       if (event) {
         event.stopPropagation();
       }
-      this.sessionClose();
       if (this.isFullscreen) {
         this.enableScrollOnRoot();
       }

File diff suppressed because it is too large
+ 0 - 0
public/assets/chat/chat-no-jquery.min.js


+ 3 - 5
public/assets/chat/chat.coffee

@@ -1108,16 +1108,14 @@ do($ = window.jQuery, window) ->
         return
       if @initDelayId
         clearTimeout(@initDelayId)
-      if !@sessionId
-        @log.debug 'can\'t close widget without sessionId'
-        return
+      if @sessionId
+        @log.debug 'session close before widget close'
+        @sessionClose()
 
       @log.debug 'close widget'
 
       event.stopPropagation() if event
 
-      @sessionClose()
-
       if @isFullscreen
         @enableScrollOnRoot()
 

File diff suppressed because it is too large
+ 0 - 1
public/assets/chat/chat.js


File diff suppressed because it is too large
+ 0 - 0
public/assets/chat/chat.min.js


+ 25 - 0
spec/system/chat_spec.rb

@@ -388,4 +388,29 @@ RSpec.describe 'Chat Handling', type: :system do
       include_examples 'chat button is hidden after idle timeout'
     end
   end
+
+  describe "Chat can't be closed after timeout #2471", authenticated_as: :authenticate do
+    shared_examples 'test issue #2471' do
+      it 'is able to close to the dialog after a idleTimeout happened' do
+        click agent_chat_switch_selector
+        open_window_and_switch
+
+        visit chat_url
+        click '.zammad-chat .js-chat-open'
+        expect(page).to have_selector('.js-restart', wait: 60)
+        click '.js-chat-toggle .zammad-chat-header-icon'
+        expect(page).to have_no_selector('zammad-chat-is-open', wait: 60)
+      end
+    end
+
+    context 'with jquery' do
+      include_examples 'test issue #2471'
+    end
+
+    context 'wihtout jquery' do
+      let(:chat_url_type) { 'znuny-no-jquery' }
+
+      include_examples 'test issue #2471'
+    end
+  end
 end

Some files were not shown because too many files changed in this diff