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

Fix closing MUC from rooms list

View isn't defined if chat is in background
JC Brand 4 жил өмнө
parent
commit
a5d428c42d

+ 0 - 1
dev.html

@@ -29,7 +29,6 @@
     converse.initialize({
         auto_away: 300,
         enable_smacks: true,
-        i18n: 'af',
         loglevel: 'debug',
         message_archiving: 'always',
         muc_respect_autojoin: true,

+ 4 - 4
src/plugins/roomslist/view.js

@@ -92,13 +92,13 @@ export class RoomsList extends ElementView {
         api.chatviews.get(jid).maybeFocus();
     }
 
-    closeRoom (ev) { // eslint-disable-line class-methods-use-this
+    async closeRoom (ev) { // eslint-disable-line class-methods-use-this
         ev.preventDefault();
         const name = ev.target.getAttribute('data-room-name');
-        const jid = ev.target.getAttribute('data-room-jid');
         if (confirm(__("Are you sure you want to leave the groupchat %1$s?", name))) {
-            // TODO: replace with API call
-            _converse.chatboxviews.get(jid).close();
+            const jid = ev.target.getAttribute('data-room-jid');
+            const room = await api.rooms.get(jid);
+            room.close();
         }
     }