Ver Fonte

Refactor so that nick-deduplication takes VCard nick into account

Updates #968
JC Brand há 7 anos atrás
pai
commit
adad60e298
2 ficheiros alterados com 8 adições e 6 exclusões
  1. 1 0
      CHANGES.md
  2. 7 6
      src/converse-muc-views.js

+ 1 - 0
CHANGES.md

@@ -7,6 +7,7 @@
 - #161 XEP-0363: HTTP File Upload
 - #194 Include entity capabilities in outgoing presence stanzas
 - #337 API call to update a VCard
+- #968 Use nickname from VCard when joining a room
 - #1094 Show room members who aren't currently online
 - It's now also possible to edit your VCard via the UI
 - Automatically grow/shrink input as text is entered/removed

+ 7 - 6
src/converse-muc-views.js

@@ -1106,13 +1106,9 @@
                 },
 
                 onNickNameNotFound (message) {
-                    const nick = _converse.xmppstatus.vcard.get('nickname');
+                    const nick = this.getDefaultNickName();
                     if (nick) {
                         this.join(nick);
-                    } else if (_converse.muc_nickname_from_jid) {
-                        // We try to enter the room with the node part of
-                        // the user's JID.
-                        this.join(this.getDefaultNickName());
                     } else {
                         this.renderNicknameForm(message);
                     }
@@ -1124,7 +1120,12 @@
                      * We put this in a separate method so that it can be
                      * overridden by plugins.
                      */
-                    return Strophe.unescapeNode(Strophe.getNodeFromJid(_converse.bare_jid));
+                    const nick = _converse.xmppstatus.vcard.get('nickname');
+                    if (nick) {
+                        return nick;
+                    } else if (_converse.muc_nickname_from_jid) {
+                        return Strophe.unescapeNode(Strophe.getNodeFromJid(_converse.bare_jid));
+                    }
                 },
 
                 onNicknameClash (presence) {