Commit 8806efce authored by JC Brand's avatar JC Brand

Include nick when registering someone as a member

This will cause their nick to be registered (if Prosody supports it).
parent f5b10ff6
......@@ -960,6 +960,7 @@
this.model.occupants.findWhere({'jid': args[0]});
this.model.setAffiliation('member', [{
'jid': occupant.get('jid'),
'nick': occupant.get('nick'),
'reason': args[1]
}]).then(
() => this.model.occupants.fetchMembers(),
......
......@@ -543,7 +543,7 @@
* XXX: Prosody doesn't accept multiple JIDs' affiliations
* being set in one IQ stanza, so as a workaround we send
* a separate stanza for each JID.
* Related ticket: https://prosody.im/issues/issue/795
* Related ticket: https://issues.prosody.im/345
*
* Parameters:
* (String) affiliation: The affiliation
......@@ -701,6 +701,7 @@
.c("query", {xmlns: Strophe.NS.MUC_ADMIN})
.c("item", {
'affiliation': member.affiliation || affiliation,
'nick': member.nick,
'jid': member.jid
});
if (!_.isUndefined(member.reason)) {
......@@ -810,6 +811,7 @@
},
async registerNickname () {
// See https://xmpp.org/extensions/xep-0045.html#register
const nick = this.get('nick'),
jid = this.get('jid');
let iq;
......@@ -829,7 +831,6 @@
}
return _converse.log(e, Strophe.LogLevel.ERROR);
}
const required_fields = _.map(sizzle('field required', iq), 'parentElement');
if (required_fields.length > 1 || required_fields[0].getAttribute('var') !== 'muc#register_roomnick') {
return _converse.log(`Can't register the user register in the groupchat ${jid} due to the required fields`);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment