Ensure new contact is attached to existing chatbox
When a new contact is added, check if we already have a chatbox open for it, and if so attach it to the chatbox.
This commit is contained in:
parent
3e4f4e9436
commit
9b0e23dcc6
15
dist/converse.js
vendored
15
dist/converse.js
vendored
|
@ -49082,6 +49082,21 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
|
|||
});
|
||||
/************************ BEGIN Event Handlers ************************/
|
||||
|
||||
_converse.api.waitUntil('rosterContactsFetched').then(() => {
|
||||
_converse.roster.on('add', contact => {
|
||||
/* When a new contact is added, check if we already have a
|
||||
* chatbox open for it, and if so attach it to the chatbox.
|
||||
*/
|
||||
const chatbox = _converse.chatboxes.findWhere({
|
||||
'jid': contact.get('jid')
|
||||
});
|
||||
|
||||
if (chatbox) {
|
||||
chatbox.addRelatedContact(contact);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
_converse.api.listen.on('chatBoxesInitialized', () => {
|
||||
_converse.chatboxviews = new _converse.ChatBoxViews({
|
||||
'model': _converse.chatboxes
|
||||
|
|
|
@ -152,6 +152,18 @@ converse.plugins.add('converse-chatboxviews', {
|
|||
|
||||
|
||||
/************************ BEGIN Event Handlers ************************/
|
||||
_converse.api.waitUntil('rosterContactsFetched').then(() => {
|
||||
_converse.roster.on('add', (contact) => {
|
||||
/* When a new contact is added, check if we already have a
|
||||
* chatbox open for it, and if so attach it to the chatbox.
|
||||
*/
|
||||
const chatbox = _converse.chatboxes.findWhere({'jid': contact.get('jid')});
|
||||
if (chatbox) {
|
||||
chatbox.addRelatedContact(contact);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
_converse.api.listen.on('chatBoxesInitialized', () => {
|
||||
_converse.chatboxviews = new _converse.ChatBoxViews({
|
||||
'model': _converse.chatboxes
|
||||
|
|
Loading…
Reference in New Issue
Block a user