From 71ada54703581887e761c0f0c266f1dc6840f5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kl=C3=A4hn?= Date: Sat, 3 Dec 2022 14:45:10 +0100 Subject: [PATCH] documentation --- src/chat.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 8be73e1ef..4ad9f9c1c 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1293,6 +1293,8 @@ impl Chat { self.param.get_bool(Param::Unpromoted).unwrap_or_default() } + /// Returns wheter the chat is promoted which means that a message has been + /// send to it and it not only exists on the users device. pub fn is_promoted(&self) -> bool { !self.is_unpromoted() } @@ -2736,6 +2738,7 @@ pub(crate) async fn remove_from_chat_contacts_table( } /// Adds a contact to the chat. +/// If the group is promoted, also send out a system message to all group members pub async fn add_contact_to_chat( context: &Context, chat_id: ChatId, @@ -2757,7 +2760,7 @@ pub(crate) async fn add_contact_to_chat_ex( chat_id.reset_gossiped_timestamp(context).await?; - /*this also makes sure, not contacts are added to special or normal chats*/ + // this also makes sure, no contacts are added to special or normal chats let mut chat = Chat::load_from_db(context, chat_id).await?; ensure!( chat.typ == Chattype::Group || chat.typ == Chattype::Broadcast, @@ -2779,7 +2782,7 @@ pub(crate) async fn add_contact_to_chat_ex( context.emit_event(EventType::ErrorSelfNotInGroup( "Cannot add contact to group; self not in group.".into(), )); - bail!("can not add contact because our account is not part of it"); + bail!("can not add contact because the account is not part of the group/broadcast"); } if from_handshake && chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 1 {