Prechádzať zdrojové kódy

Bugfix. Make sure new attrs are applied.

JC Brand 6 rokov pred
rodič
commit
8864925407
1 zmenil súbory, kde vykonal 5 pridanie a 2 odobranie
  1. 5 2
      src/headless/converse-chatboxes.js

+ 5 - 2
src/headless/converse-chatboxes.js

@@ -1166,7 +1166,8 @@ converse.plugins.add('converse-chatboxes', {
              * @method _converse.ChatBox#getChatBox
              * @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 { 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) {
                 if (_.isObject(jid)) {
@@ -1177,7 +1178,9 @@ converse.plugins.add('converse-chatboxes', {
                 jid = Strophe.getBareJidFromJid(jid.toLowerCase());
 
                 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});
                     chatbox = this.create(attrs, {
                         'error' (model, response) {