Fixes #1791: Adhere to the auto_focus setting

This commit is contained in:
JC Brand 2020-01-09 14:28:43 +01:00
parent 224f41ca8a
commit 2dae07fa87
4 changed files with 9 additions and 10 deletions

View File

@ -30,6 +30,7 @@
- #1691: Fix `collection.chatbox is undefined` errors
- #1767: `credentials_url` is not called when logging out and then in again
- #1772: `_converse.api.contact.add(jid, nick)` fails, says not a function
- #1791: `auto_focus` set to `false` is ignored when switching back to a MUC
- #1792: Fix: modals don't have scrollbars
- #1796: Don't show "back" arrow navigation (on mobile) in the chat header when in `singleton` mode
- #1821: Errors caused by malformed URLs are now handled

View File

@ -1214,6 +1214,10 @@ converse.plugins.add('converse-chatview', {
return this;
},
maybeFocus () {
_converse.auto_focus && this.focus();
},
hide () {
this.el.classList.add('hidden');
return this;
@ -1223,16 +1227,12 @@ converse.plugins.add('converse-chatview', {
this.model.clearUnreadMsgCounter();
this.model.setChatState(_converse.ACTIVE);
this.scrollDown();
if (_converse.auto_focus) {
this.focus();
}
this.maybeFocus();
},
show () {
if (u.isVisible(this.el)) {
if (_converse.auto_focus) {
this.focus();
}
this.maybeFocus();
return;
}
/**

View File

@ -1131,9 +1131,7 @@ converse.plugins.add('converse-muc-views', {
} else if (conn_status === converse.ROOMSTATUS.ENTERED) {
this.renderBottomPanel();
this.hideSpinner();
if (_converse.auto_focus) {
this.focus();
}
this.maybeFocus();
} else if (conn_status === converse.ROOMSTATUS.DISCONNECTED) {
this.showDisconnectMessage();
} else if (conn_status === converse.ROOMSTATUS.DESTROYED) {

View File

@ -134,7 +134,7 @@ converse.plugins.add('converse-roomslist', {
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)) || jid
}
await _converse.api.rooms.open(jid, data, true);
_converse.api.chatviews.get(jid).focus();
_converse.api.chatviews.get(jid).maybeFocus();
},
closeRoom (ev) {