Fix closing MUC from rooms list

View isn't defined if chat is in background
This commit is contained in:
JC Brand 2021-04-23 11:41:40 +02:00
parent b2445d36d1
commit a5d428c42d
2 changed files with 4 additions and 5 deletions

View File

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

View File

@ -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();
}
}