@@ -534,8 +534,10 @@ fn process_block(from: &Arc<Session>, whom: UserId) -> MessageResult {
534
534
janus_info ! ( "Processing block from {:p} to {}" , from. handle, whom) ;
535
535
if let Some ( joined) = from. join_state . get ( ) {
536
536
let mut switchboard = SWITCHBOARD . write ( ) ?;
537
- let event = json ! ( { "event" : "blocked" , "by" : & joined. user_id } ) ;
538
- notify_user ( & event, & whom, switchboard. publishers_occupying ( & joined. room_id ) ) ;
537
+ if let Some ( publisher) = switchboard. get_publisher ( & whom) {
538
+ let event = json ! ( { "event" : "blocked" , "by" : & joined. user_id } ) ;
539
+ notify_user ( & event, & whom, & [ publisher] ) ;
540
+ }
539
541
switchboard. establish_block ( joined. user_id . clone ( ) , whom) ;
540
542
Ok ( MessageResponse :: msg ( json ! ( { } ) ) )
541
543
} else {
@@ -550,9 +552,9 @@ fn process_unblock(from: &Arc<Session>, whom: UserId) -> MessageResult {
550
552
switchboard. lift_block ( & joined. user_id , & whom) ;
551
553
if let Some ( publisher) = switchboard. get_publisher ( & whom) {
552
554
send_fir ( & [ publisher] ) ;
555
+ let event = json ! ( { "event" : "unblocked" , "by" : & joined. user_id } ) ;
556
+ notify_user ( & event, & whom, & [ publisher] ) ;
553
557
}
554
- let event = json ! ( { "event" : "unblocked" , "by" : & joined. user_id } ) ;
555
- notify_user ( & event, & whom, switchboard. publishers_occupying ( & joined. room_id ) ) ;
556
558
Ok ( MessageResponse :: msg ( json ! ( { } ) ) )
557
559
} else {
558
560
Err ( From :: from ( "Cannot unblock when not in a room." ) )
0 commit comments