Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix /nick command not working #2497

Merged
merged 1 commit into from Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -2270,7 +2270,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 @@ -2280,7 +2280,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