Browse Source

fix(xmpp): Moves event local user role changed after muc joined.

dev0
damencho 6 months ago
parent
commit
492a3e92ac
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      modules/xmpp/ChatRoom.js

+ 7
- 6
modules/xmpp/ChatRoom.js View File

638
             const newRole
638
             const newRole
639
                 = member.affiliation === 'owner' ? member.role : 'none';
639
                 = member.affiliation === 'owner' ? member.role : 'none';
640
 
640
 
641
-            if (this.role !== newRole) {
642
-                this.role = newRole;
643
-                this.eventEmitter.emit(
644
-                    XMPPEvents.LOCAL_ROLE_CHANGED,
645
-                    this.role);
646
-            }
647
             if (!this.joined) {
641
             if (!this.joined) {
648
                 this.joined = true;
642
                 this.joined = true;
649
                 const now = this.connectionTimes['muc.joined']
643
                 const now = this.connectionTimes['muc.joined']
677
                 !this.options.disableDiscoInfo && this.discoRoomInfo();
671
                 !this.options.disableDiscoInfo && this.discoRoomInfo();
678
             }
672
             }
679
 
673
 
674
+            if (this.role !== newRole) {
675
+                this.role = newRole;
676
+                this.eventEmitter.emit(
677
+                    XMPPEvents.LOCAL_ROLE_CHANGED,
678
+                    this.role);
679
+            }
680
+
680
             if (xElement && $(xElement).find('>status[code="110"]').length) {
681
             if (xElement && $(xElement).find('>status[code="110"]').length) {
681
                 // let's check for some backend forced permissions
682
                 // let's check for some backend forced permissions
682
 
683
 

Loading…
Cancel
Save