Skip to content

Commit

Permalink
Don't update the participant list when only you joined
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Jan 13, 2022
1 parent 9221a79 commit 7945581
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ Signaling.Standalone.prototype.processRoomEvent = function(data) {
// may now no longer exist.
leftUsers = Object.assign({}, this.joinedUsers)
}

let userListIsDirty = false
for (i = 0; i < joinedUsers.length; i++) {
this.joinedUsers[joinedUsers[i].sessionid] = true
delete leftUsers[joinedUsers[i].sessionid]
Expand All @@ -1176,6 +1178,8 @@ Signaling.Standalone.prototype.processRoomEvent = function(data) {
// as otherwise you get the warning for your own old session immediately
this.ownSessionJoined = true
}
} else {
userListIsDirty = true
}
}
leftUsers = Object.keys(leftUsers)
Expand All @@ -1184,10 +1188,16 @@ Signaling.Standalone.prototype.processRoomEvent = function(data) {

for (i = 0; i < leftUsers.length; i++) {
delete this.joinedUsers[leftUsers[i]]

if (!this.settings.userId || leftUsers[i].userid !== this.settings.userId) {
userListIsDirty = true
}
}
}
this._trigger('usersJoined', [joinedUsers])
this._trigger('participantListChanged')
if (userListIsDirty) {
this._trigger('participantListChanged')
}
}
break
case 'leave':
Expand Down

0 comments on commit 7945581

Please sign in to comment.