Skip to content

Commit

Permalink
fix: Sends set admin only when not empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Apr 24, 2024
1 parent f5f1c31 commit eed9bbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1452,16 +1452,19 @@ export default class ChatRoom extends Listenable {
type: 'set' })
.c('query', {
xmlns: 'http://jabber.org/protocol/muc#admin' });
let sendIq = false;

Object.values(this.members).forEach(m => {
if (m.jid && !MEMBERS_AFFILIATIONS.includes(m.affiliation)) {
affiliationsIq.c('item', {
'affiliation': 'member',
'jid': Strophe.getBareJidFromJid(m.jid)
}).up();
sendIq = true;
}
});
this.xmpp.connection.sendIQ(affiliationsIq.up());

sendIq && this.xmpp.connection.sendIQ(affiliationsIq.up());
}

const errorCallback = onError ? onError : () => {}; // eslint-disable-line no-empty-function
Expand Down

0 comments on commit eed9bbc

Please sign in to comment.