瀏覽代碼

fix: Sends set admin only when not empty.

release-8443
damencho 1 年之前
父節點
當前提交
c4cee68168
共有 1 個檔案被更改,包括 4 行新增1 行删除
  1. 4
    1
      modules/xmpp/ChatRoom.js

+ 4
- 1
modules/xmpp/ChatRoom.js 查看文件

@@ -1452,6 +1452,7 @@ export default class ChatRoom extends Listenable {
1452 1452
                 type: 'set' })
1453 1453
                 .c('query', {
1454 1454
                     xmlns: 'http://jabber.org/protocol/muc#admin' });
1455
+            let sendIq = false;
1455 1456
 
1456 1457
             Object.values(this.members).forEach(m => {
1457 1458
                 if (m.jid && !MEMBERS_AFFILIATIONS.includes(m.affiliation)) {
@@ -1459,9 +1460,11 @@ export default class ChatRoom extends Listenable {
1459 1460
                         'affiliation': 'member',
1460 1461
                         'jid': Strophe.getBareJidFromJid(m.jid)
1461 1462
                     }).up();
1463
+                    sendIq = true;
1462 1464
                 }
1463 1465
             });
1464
-            this.xmpp.connection.sendIQ(affiliationsIq.up());
1466
+
1467
+            sendIq && this.xmpp.connection.sendIQ(affiliationsIq.up());
1465 1468
         }
1466 1469
 
1467 1470
         const errorCallback = onError ? onError : () => {}; // eslint-disable-line no-empty-function

Loading…
取消
儲存