Commit 88649254 authored by JC Brand's avatar JC Brand

Bugfix. Make sure new attrs are applied.

parent bda567ca
...@@ -1166,7 +1166,8 @@ converse.plugins.add('converse-chatboxes', { ...@@ -1166,7 +1166,8 @@ converse.plugins.add('converse-chatboxes', {
* @method _converse.ChatBox#getChatBox * @method _converse.ChatBox#getChatBox
* @param { string } jid - The JID of the user whose chat box we want * @param { string } jid - The JID of the user whose chat box we want
* @param { boolean } create - Should a new chat box be created if none exists? * @param { boolean } create - Should a new chat box be created if none exists?
* @param { object } attrs - Optional chat box atributes. * @param { object } attrs - Optional chat box atributes. If the
* chat box already exists, its attributes will be updated.
*/ */
getChatBox (jid, attrs={}, create) { getChatBox (jid, attrs={}, create) {
if (_.isObject(jid)) { if (_.isObject(jid)) {
...@@ -1177,7 +1178,9 @@ converse.plugins.add('converse-chatboxes', { ...@@ -1177,7 +1178,9 @@ converse.plugins.add('converse-chatboxes', {
jid = Strophe.getBareJidFromJid(jid.toLowerCase()); jid = Strophe.getBareJidFromJid(jid.toLowerCase());
let chatbox = this.get(Strophe.getBareJidFromJid(jid)); let chatbox = this.get(Strophe.getBareJidFromJid(jid));
if (!chatbox && create) { if (chatbox) {
chatbox.save(attrs);
} else if (create) {
Object.assign(attrs, {'jid': jid, 'id': jid}); Object.assign(attrs, {'jid': jid, 'id': jid});
chatbox = this.create(attrs, { chatbox = this.create(attrs, {
'error' (model, response) { 'error' (model, response) {
......
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