From a5d428c42d3cd1bff593854ae439a992671231c5 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 23 Apr 2021 11:41:40 +0200 Subject: [PATCH] Fix closing MUC from rooms list View isn't defined if chat is in background --- dev.html | 1 - src/plugins/roomslist/view.js | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dev.html b/dev.html index ef5611612..59bd28219 100644 --- a/dev.html +++ b/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, diff --git a/src/plugins/roomslist/view.js b/src/plugins/roomslist/view.js index 3603149cf..a85ca712d 100644 --- a/src/plugins/roomslist/view.js +++ b/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(); } }