Skip to content

Commit

Permalink
fix /nick command not working
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaosKid42 authored and jcbrand committed Jun 3, 2021
1 parent 1598640 commit 8701708
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/headless/plugins/muc/muc.js
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 8701708

Please sign in to comment.