@@ -541,8 +541,10 @@ fn process_block(from: &Arc<Session>, whom: UserId) -> MessageResult {
541
541
janus_info ! ( "Processing block from {:p} to {}" , from. handle, whom) ;
542
542
if let Some ( joined) = from. join_state . get ( ) {
543
543
let mut switchboard = SWITCHBOARD . write ( ) ?;
544
- let event = json ! ( { "event" : "blocked" , "by" : & joined. user_id } ) ;
545
- notify_user ( & event, & whom, switchboard. publishers_occupying ( & joined. room_id ) ) ;
544
+ if let Some ( publisher) = switchboard. get_publisher ( & whom) {
545
+ let event = json ! ( { "event" : "blocked" , "by" : & joined. user_id } ) ;
546
+ notify_user ( & event, & whom, & [ publisher] ) ;
547
+ }
546
548
switchboard. establish_block ( joined. user_id . clone ( ) , whom) ;
547
549
Ok ( MessageResponse :: msg ( json ! ( { } ) ) )
548
550
} else {
@@ -557,9 +559,9 @@ fn process_unblock(from: &Arc<Session>, whom: UserId) -> MessageResult {
557
559
switchboard. lift_block ( & joined. user_id , & whom) ;
558
560
if let Some ( publisher) = switchboard. get_publisher ( & whom) {
559
561
send_fir ( & [ publisher] ) ;
562
+ let event = json ! ( { "event" : "unblocked" , "by" : & joined. user_id } ) ;
563
+ notify_user ( & event, & whom, & [ publisher] ) ;
560
564
}
561
- let event = json ! ( { "event" : "unblocked" , "by" : & joined. user_id } ) ;
562
- notify_user ( & event, & whom, switchboard. publishers_occupying ( & joined. room_id ) ) ;
563
565
Ok ( MessageResponse :: msg ( json ! ( { } ) ) )
564
566
} else {
565
567
Err ( From :: from ( "Cannot unblock when not in a room." ) )
0 commit comments