Przeglądaj źródła

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 lat temu
rodzic
commit
425b260a94
No account linked to committer's email address
1 zmienionych plików z 8 dodań i 8 usunięć
  1. 8
    8
      JitsiConference.js

+ 8
- 8
JitsiConference.js Wyświetl plik

@@ -1020,15 +1020,15 @@ JitsiConference.prototype.setDisplayName = function(name) {
1020 1020
     if (this.room) {
1021 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
 

Ładowanie…
Anuluj
Zapisz