2
0
Эх сурвалжийг харах

#2092 fixes room list update loop with locked muc domains (#2268)

* Only update the room list after shown.bs.modal
* add changes to CHANGES.md
* Move shown listener to initialize
Koen Van den Wijngaert 4 жил өмнө
parent
commit
15aef10d5d
2 өөрчлөгдсөн 6 нэмэгдсэн , 11 устгасан
  1. 1 0
      CHANGES.md
  2. 5 11
      src/modals/muc-list.js

+ 1 - 0
CHANGES.md

@@ -34,6 +34,7 @@ Soon we'll deprecate the latter, so prepare now.
 - #2201: added html to converse.env
 - #2213: added CustomElement to converse.env
 - #2220: fix rendering of emojis in case `use_system_emojis == false` (again).
+- #2092: fixes room list update loop when having the `locked_muc_domain` truthy or `'hidden'`
 - The `api.archive.query` method no longer accepts an RSM instance as argument.
 - The plugin `converse-uniview` has been removed and its functionality merged into `converse-chatboxviews`
 - Removed the mockups from the project. Recommended to use tests instead.

+ 5 - 11
src/modals/muc-list.js

@@ -93,6 +93,11 @@ export default BootstrapModal.extend({
             this.model.save('muc_domain', api.settings.get('muc_domain'));
         }
         this.listenTo(this.model, 'change:muc_domain', this.onDomainChange);
+
+        this.el.addEventListener('shown.bs.modal', () => api.settings.get('locked_muc_domain')
+          ? this.updateRoomsList()
+          : this.el.querySelector('input[name="server"]').focus()
+        );
     },
 
     toHTML () {
@@ -110,17 +115,6 @@ export default BootstrapModal.extend({
             }));
     },
 
-    afterRender () {
-        if (api.settings.get('locked_muc_domain')) {
-            this.updateRoomsList();
-        } else {
-            this.el.addEventListener('shown.bs.modal',
-                () => this.el.querySelector('input[name="server"]').focus(),
-                false
-            );
-        }
-    },
-
     openRoom (ev) {
         ev.preventDefault();
         const jid = ev.target.getAttribute('data-room-jid');