Ver Fonte

fix /nick command not working

Christoph Scholz há 4 anos atrás
pai
commit
8701708b53
2 ficheiros alterados com 3 adições e 2 exclusões
  1. 1 0
      CHANGES.md
  2. 2 2
      src/headless/plugins/muc/muc.js

+ 1 - 0
CHANGES.md

@@ -24,6 +24,7 @@
 - Use the MUC stanza id when sending XEP-0333 markers
 - Add support for rendering unfurls via [mod_ogp](https://modules.prosody.im/mod_ogp.html)
 - Add a Description Of A Project (DOAP) file
+- #2497: Bugfix /nick command is not working
 
 ### Breaking Changes
 

+ 2 - 2
src/headless/plugins/muc/muc.js

@@ -2271,7 +2271,7 @@ const ChatRoomMixin = {
             data.message = _converse.muc.info_messages[code];
         } else if (!is_self && ACTION_INFO_CODES.includes(code)) {
             const nick = Strophe.getResourceFromJid(stanza.getAttribute('from'));
-            const item = stanza.querySelector(`x[xmlns="${Strophe.NS.MUC_USER}"] item`);
+            const item = sizzle(`x[xmlns="${Strophe.NS.MUC_USER}"] item`, stanza).pop();
             data.actor = item ? item.querySelector('actor')?.getAttribute('nick') : undefined;
             data.reason = item ? item.querySelector('reason')?.textContent : undefined;
             data.message = this.getActionInfoMessage(code, nick, data.actor);
@@ -2281,7 +2281,7 @@ const ChatRoomMixin = {
             if (is_self && code === '210') {
                 nick = Strophe.getResourceFromJid(stanza.getAttribute('from'));
             } else if (is_self && code === '303') {
-                nick = stanza.querySelector(`x[xmlns="${Strophe.NS.MUC_USER}"] item`).getAttribute('nick');
+                nick = sizzle(`x[xmlns="${Strophe.NS.MUC_USER}"] item`, stanza).pop().getAttribute('nick');
             }
             this.save('nick', nick);
             data.message = __(_converse.muc.new_nickname_messages[code], nick);