Commit b8107afa authored by JC Brand's avatar JC Brand

Bugfix. Remove highlight from roster item when chatbox is closed.

parent f0201e23
...@@ -59683,12 +59683,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins ...@@ -59683,12 +59683,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
if (_converse.isUniView()) { if (_converse.isUniView()) {
const chatbox = _converse.chatboxes.get(this.model.get('jid')); const chatbox = _converse.chatboxes.get(this.model.get('jid'));
if (chatbox) { if (chatbox && chatbox.get('hidden') || !chatbox) {
if (chatbox.get('hidden')) { this.el.classList.remove('open');
this.el.classList.remove('open'); } else {
} else { this.el.classList.add('open');
this.el.classList.add('open');
}
} }
} }
}, },
...@@ -60278,15 +60276,19 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins ...@@ -60278,15 +60276,19 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
/* -------- Event Handlers ----------- */ /* -------- Event Handlers ----------- */
_converse.api.listen.on('chatBoxesInitialized', () => { _converse.api.listen.on('chatBoxesInitialized', () => {
_converse.chatboxes.on('change:hidden', chatbox => { function highlightRosterItem(chatbox) {
const contact = _converse.roster.findWhere({ const contact = _converse.roster.findWhere({
'jid': chatbox.get('jid') 'jid': chatbox.get('jid')
}); });
if (!_.isUndefined(contact)) { if (!_.isUndefined(contact)) {
contact.trigger('highlight', contact); contact.trigger('highlight');
} }
}); }
_converse.chatboxes.on('destroy', chatbox => highlightRosterItem(chatbox));
_converse.chatboxes.on('change:hidden', chatbox => highlightRosterItem(chatbox));
}); });
function initRoster() { function initRoster() {
...@@ -485,12 +485,10 @@ converse.plugins.add('converse-rosterview', { ...@@ -485,12 +485,10 @@ converse.plugins.add('converse-rosterview', {
*/ */
if (_converse.isUniView()) { if (_converse.isUniView()) {
const chatbox = _converse.chatboxes.get(this.model.get('jid')); const chatbox = _converse.chatboxes.get(this.model.get('jid'));
if (chatbox) { if ((chatbox && chatbox.get('hidden')) || !chatbox) {
if (chatbox.get('hidden')) { this.el.classList.remove('open');
this.el.classList.remove('open'); } else {
} else { this.el.classList.add('open');
this.el.classList.add('open');
}
} }
} }
}, },
...@@ -1009,16 +1007,16 @@ converse.plugins.add('converse-rosterview', { ...@@ -1009,16 +1007,16 @@ converse.plugins.add('converse-rosterview', {
} }
}); });
/* -------- Event Handlers ----------- */ /* -------- Event Handlers ----------- */
_converse.api.listen.on('chatBoxesInitialized', () => { _converse.api.listen.on('chatBoxesInitialized', () => {
function highlightRosterItem (chatbox) {
_converse.chatboxes.on('change:hidden', (chatbox) => {
const contact = _converse.roster.findWhere({'jid': chatbox.get('jid')}); const contact = _converse.roster.findWhere({'jid': chatbox.get('jid')});
if (!_.isUndefined(contact)) { if (!_.isUndefined(contact)) {
contact.trigger('highlight', contact); contact.trigger('highlight');
} }
}); }
_converse.chatboxes.on('destroy', chatbox => highlightRosterItem(chatbox));
_converse.chatboxes.on('change:hidden', chatbox => highlightRosterItem(chatbox));
}); });
function initRoster () { function initRoster () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment