Browse Source

fix: Do not send empty <nick/> when a nick exists and gets removed (#2170)

* fix: Do not send empty <nick/> when a nick exists and gets removed

* squash: Fix lint errors.
tags/v0.0.2
bgrozev 2 years ago
parent
commit
425b260a94
No account linked to committer's email address
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      JitsiConference.js

+ 8
- 8
JitsiConference.js View File

1020
     if (this.room) {
1020
     if (this.room) {
1021
         const nickKey = 'nick';
1021
         const nickKey = 'nick';
1022
 
1022
 
1023
-        // if there is no display name already set, avoid setting an empty one
1024
-        if (!name && !this.room.getFromPresence(nickKey)) {
1025
-            return;
1023
+        if (name) {
1024
+            this.room.addOrReplaceInPresence(nickKey, {
1025
+                attributes: { xmlns: 'http://jabber.org/protocol/nick' },
1026
+                value: name
1027
+            }) && this.room.sendPresence();
1028
+        } else if (this.room.getFromPresence(nickKey)) {
1029
+            this.room.removeFromPresence(nickKey);
1030
+            this.room.sendPresence();
1026
         }
1031
         }
1027
-
1028
-        this.room.addOrReplaceInPresence(nickKey, {
1029
-            attributes: { xmlns: 'http://jabber.org/protocol/nick' },
1030
-            value: name
1031
-        }) && this.room.sendPresence();
1032
     }
1032
     }
1033
 };
1033
 };
1034
 
1034
 

Loading…
Cancel
Save