소스 검색

Send a XEP-0410 ping when we restore a MUC from cache

and re-enter if necessary.

This solves the problem where we "clone" a tab (e.g. middle-click) and
then restore a MUC from cache which we haven't actually entered (given
that the new tab represents a new device and session).

Also... add `await` in a test to try and fix Travis flakiness
JC Brand 6 년 전
부모
커밋
8db839b4cf
2개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 2
      spec/roomslist.js
  2. 1 1
      src/headless/converse-muc.js

+ 5 - 2
spec/roomslist.js

@@ -290,7 +290,7 @@
             test_utils.openControlBox();
             const room_jid = 'kitchen@conference.shakespeare.lit';
             await test_utils.waitUntil(() => !_.isUndefined(_converse.rooms_list_view), 500);
-            await  test_utils.openAndEnterChatRoom(_converse, 'kitchen', 'conference.shakespeare.lit', 'romeo');
+            await test_utils.openAndEnterChatRoom(_converse, 'kitchen', 'conference.shakespeare.lit', 'romeo');
             const view = _converse.chatboxviews.get(room_jid);
             view.model.set({'minimized': true});
             const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
@@ -303,8 +303,11 @@
                     type: 'groupchat'
                 }).c('body').t('foo').tree());
 
+            const lview = _converse.rooms_list_view
+            await test_utils.waitUntil(() => lview.el.querySelectorAll(".available-chatroom").length);
+
             // If the user isn't mentioned, the counter doesn't get incremented, but the text of the groupchat is bold
-            let room_el = _converse.rooms_list_view.el.querySelector(".available-chatroom");
+            let room_el = lview.el.querySelector(".available-chatroom");
             expect(_.includes(room_el.classList, 'unread-msgs')).toBeTruthy();
 
             // If the user is mentioned, the counter also gets updated

+ 1 - 1
src/headless/converse-muc.js

@@ -310,7 +310,7 @@ converse.plugins.add('converse-muc', {
                         return;
                     }
                     this.join();
-                } else {
+                } else if (!(await this.rejoinIfNecessary())) {
                     this.features.fetch();
                     this.fetchMessages();
                 }