mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
documentation
This commit is contained in:
@@ -1293,6 +1293,8 @@ impl Chat {
|
|||||||
self.param.get_bool(Param::Unpromoted).unwrap_or_default()
|
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 {
|
pub fn is_promoted(&self) -> bool {
|
||||||
!self.is_unpromoted()
|
!self.is_unpromoted()
|
||||||
}
|
}
|
||||||
@@ -2736,6 +2738,7 @@ pub(crate) async fn remove_from_chat_contacts_table(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a contact to the chat.
|
/// 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(
|
pub async fn add_contact_to_chat(
|
||||||
context: &Context,
|
context: &Context,
|
||||||
chat_id: ChatId,
|
chat_id: ChatId,
|
||||||
@@ -2757,7 +2760,7 @@ pub(crate) async fn add_contact_to_chat_ex(
|
|||||||
|
|
||||||
chat_id.reset_gossiped_timestamp(context).await?;
|
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?;
|
let mut chat = Chat::load_from_db(context, chat_id).await?;
|
||||||
ensure!(
|
ensure!(
|
||||||
chat.typ == Chattype::Group || chat.typ == Chattype::Broadcast,
|
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(
|
context.emit_event(EventType::ErrorSelfNotInGroup(
|
||||||
"Cannot add contact to group; self not in group.".into(),
|
"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 {
|
if from_handshake && chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user