Просмотр исходного кода

Move MUC sidebar component to plugin folder

and fix update issue where occupants weren't being shown in the sidebar
when reloading the page
JC Brand 4 лет назад
Родитель
Сommit
c43969fece

+ 0 - 1
src/plugins/muc-views/index.js

@@ -4,7 +4,6 @@
  * @description XEP-0045 Multi-User Chat Views
  * @description XEP-0045 Multi-User Chat Views
  * @license Mozilla Public License (MPLv2)
  * @license Mozilla Public License (MPLv2)
  */
  */
-import '../../components/muc-sidebar';
 import '../chatview/index.js';
 import '../chatview/index.js';
 import '../modal.js';
 import '../modal.js';
 import MUCView from './muc.js';
 import MUCView from './muc.js';

+ 2 - 1
src/components/muc-sidebar.js → src/plugins/muc-views/sidebar.js

@@ -1,6 +1,6 @@
 import 'shared/autocomplete/index.js';
 import 'shared/autocomplete/index.js';
 import tpl_muc_sidebar from "templates/muc_sidebar.js";
 import tpl_muc_sidebar from "templates/muc_sidebar.js";
-import { CustomElement } from './element.js';
+import { CustomElement } from 'components/element.js';
 import { api, converse } from "@converse/headless/core";
 import { api, converse } from "@converse/headless/core";
 
 
 const u = converse.env.utils;
 const u = converse.env.utils;
@@ -20,6 +20,7 @@ export default class MUCSidebar extends CustomElement {
         this.listenTo(this.occupants, 'add', this.requestUpdate);
         this.listenTo(this.occupants, 'add', this.requestUpdate);
         this.listenTo(this.occupants, 'remove', this.requestUpdate);
         this.listenTo(this.occupants, 'remove', this.requestUpdate);
         this.listenTo(this.occupants, 'change', this.requestUpdate);
         this.listenTo(this.occupants, 'change', this.requestUpdate);
+        this.chatroom.initialized.then(() => this.requestUpdate());
     }
     }
 
 
     render () {
     render () {

+ 2 - 1
src/plugins/muc-views/templates/muc.js

@@ -1,5 +1,6 @@
-import '../heading.js';
 import '../bottom_panel.js';
 import '../bottom_panel.js';
+import '../heading.js';
+import '../sidebar.js';
 import { html } from "lit-html";
 import { html } from "lit-html";
 
 
 export default (o) => html`
 export default (o) => html`