Honor autoSubscribe when subscription permissions are granted later (#381)
* Ensure autosubscribe is honored when subscription permissions were granted later * negotiate even if no media has been added * don't double-negotiate
This commit is contained in:
@@ -248,7 +248,7 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName livekit.RoomNam
|
||||
Grants: pi.Grants,
|
||||
Hidden: pi.Hidden,
|
||||
Logger: pLogger,
|
||||
})
|
||||
}, pi.Permission)
|
||||
if err != nil {
|
||||
logger.Errorw("could not create participant", err)
|
||||
return
|
||||
@@ -257,9 +257,6 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName livekit.RoomNam
|
||||
if pi.Metadata != "" {
|
||||
participant.SetMetadata(pi.Metadata)
|
||||
}
|
||||
if pi.Permission != nil {
|
||||
participant.SetPermission(pi.Permission)
|
||||
}
|
||||
|
||||
// join room
|
||||
opts := rtc.ParticipantOptions{
|
||||
@@ -461,7 +458,10 @@ func (r *RoomManager) handleRTCMessage(_ context.Context, roomName livekit.RoomN
|
||||
participant.SetMetadata(rm.UpdateParticipant.Metadata)
|
||||
}
|
||||
if rm.UpdateParticipant.Permission != nil {
|
||||
participant.SetPermission(rm.UpdateParticipant.Permission)
|
||||
err := room.SetParticipantPermission(participant, rm.UpdateParticipant.Permission)
|
||||
if err != nil {
|
||||
pLogger.Errorw("could not update permissions", err)
|
||||
}
|
||||
}
|
||||
case *livekit.RTCNodeMessage_DeleteRoom:
|
||||
for _, p := range room.GetParticipants() {
|
||||
|
||||
Reference in New Issue
Block a user