@@ -2846,8 +2846,8 @@ pub async fn is_contact_in_chat(
28462846)  -> Result < bool >  { 
28472847    // this function works for group and for normal chats, however, it is more useful 
28482848    // for group chats. 
2849-     // ContactId::SELF may be used to check, if the user itself is in a  
2850-     // group or incoming broadcast chat 
2849+     // ContactId::SELF may be used to check whether oneself  
2850+     // is in a  group or incoming broadcast chat 
28512851    // (ContactId::SELF is not added to 1:1 chats or outgoing broadcast channels) 
28522852
28532853    let  exists = context
@@ -2933,7 +2933,6 @@ async fn prepare_send_msg(
29332933        CantSendReason :: ContactRequest  => { 
29342934            // Allow securejoin messages, they are supposed to repair the verification. 
29352935            // If the chat is a contact request, let the user accept it later. 
2936- 
29372936            msg. param . get_cmd ( )  == SystemMessage :: SecurejoinMessage 
29382937        } 
29392938        // Allow to send "Member removed" messages so we can leave the group/broadcast. 
@@ -2950,7 +2949,7 @@ async fn prepare_send_msg(
29502949            msg. param 
29512950                . get_bool ( Param :: ForcePlaintext ) 
29522951                . unwrap_or_default ( ) 
2953-                 // V2 securejoin messages are  symmetrically encrypted, no need for the public key: 
2952+                 // "vb-request-with-auth" is  symmetrically encrypted, no need for the public key: 
29542953                || msg. is_vb_request_with_auth ( ) 
29552954        } 
29562955        _ => false , 
@@ -3994,7 +3993,7 @@ pub(crate) async fn remove_from_chat_contacts_table_without_trace(
39943993        . sql 
39953994        . execute ( 
39963995            "DELETE FROM chats_contacts 
3997-                  WHERE chat_id=? AND contact_id=?" , 
3996+             WHERE chat_id=? AND contact_id=?" , 
39983997            ( chat_id,  contact_id) , 
39993998        ) 
40003999        . await ?; 
@@ -4038,6 +4037,10 @@ pub(crate) async fn add_contact_to_chat_ex(
40384037        "invalid contact_id {} for adding to group" , 
40394038        contact_id
40404039    ) ; 
4040+     ensure ! ( 
4041+         chat. typ != Chattype :: OutBroadcast  || contact_id != ContactId :: SELF , 
4042+         "Cannot add SELF to broadcast channel." 
4043+     ) ; 
40414044    ensure ! ( 
40424045        chat. is_encrypted( context) . await ? == contact. is_key_contact( ) , 
40434046        "Only key-contacts can be added to encrypted chats" 
@@ -4092,8 +4095,9 @@ pub(crate) async fn add_contact_to_chat_ex(
40924095        let  contact_addr = contact. get_addr ( ) . to_lowercase ( ) ; 
40934096        let  added_by = if  from_handshake && chat. typ  == Chattype :: OutBroadcast  { 
40944097            // The contact was added via a QR code rather than explicit user action, 
4095-             // and there is no useful information in saying 'You added member Alice' 
4096-             // if self is the only one who can add members. 
4098+             // so it could be confusing to say 'You added member Alice'. 
4099+             // And in a broadcast, SELF is the only one who can add members, 
4100+             // so, no information is lost by just writing 'Member Alice added' instead. 
40974101            ContactId :: UNDEFINED 
40984102        }  else  { 
40994103            ContactId :: SELF 
@@ -4262,8 +4266,8 @@ pub async fn remove_contact_from_chat(
42624266        !contact_id. is_special( )  || contact_id == ContactId :: SELF , 
42634267        "Cannot remove special contact" 
42644268    ) ; 
4265-     let  chat = Chat :: load_from_db ( context,  chat_id) . await ?; 
42664269
4270+     let  chat = Chat :: load_from_db ( context,  chat_id) . await ?; 
42674271    if  chat. typ  == Chattype :: InBroadcast  { 
42684272        ensure ! ( 
42694273            contact_id == ContactId :: SELF , 
0 commit comments