Commit 14708af7 authored by JC Brand's avatar JC Brand

Refactor callback method into instance method

parent d0ddda82
......@@ -1509,6 +1509,17 @@ converse.plugins.add('converse-muc-views', {
return notification;
},
insertNotification (message) {
this.content.insertAdjacentHTML(
'beforeend',
tpl_info({
'isodate': (new Date()).toISOString(),
'extra_classes': 'chat-event',
'message': message
})
);
},
showNotificationsforUser (notification) {
/* Given the notification object generated by
* parseXUserElement, display any relevant messages and
......@@ -1527,21 +1538,13 @@ converse.plugins.add('converse-muc-views', {
this.model.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
return;
}
notification.messages.forEach(message => {
this.content.insertAdjacentHTML(
'beforeend',
tpl_info({
'isodate': (new Date()).toISOString(),
'extra_classes': 'chat-event',
'message': message
}));
});
if (notification.reason) {
this.showChatEvent(__('The reason given is: "%1$s".', notification.reason));
}
if (_.get(notification.messages, 'length')) {
notification.messages.forEach(message => this.insertNotification(message));
this.scrollDown();
}
if (notification.reason) {
this.showChatEvent(__('The reason given is: "%1$s".', notification.reason));
}
},
onOccupantAdded (occupant) {
......
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