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({ converse.initialize({
auto_away: 300, auto_away: 300,
enable_smacks: true, enable_smacks: true,
i18n: 'af',
loglevel: 'debug', loglevel: 'debug',
message_archiving: 'always', message_archiving: 'always',
muc_respect_autojoin: true, muc_respect_autojoin: true,

View File

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