mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
feat: Group and broadcast channel descriptions (#7829)
fix https://github.com/chatmail/core/issues/7766 Implementation notes: - Descriptions are only sent with member additions, when the description is changed, and when promoting a previously-unpromoted group, in order not to waste bandwith. - Descriptions are not loaded everytime a chat object is loaded, because they are only needed for the profile. Instead, they are in their own table, and can be loaded with their own JsonRPC call. --------- Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
This commit is contained in:
@@ -423,6 +423,12 @@ https://delta.chat/donate"))]
|
||||
|
||||
#[strum(props(fallback = "Incoming video call"))]
|
||||
IncomingVideoCall = 235,
|
||||
|
||||
#[strum(props(fallback = "You changed the chat description."))]
|
||||
MsgYouChangedDescription = 240,
|
||||
|
||||
#[strum(props(fallback = "Chat description changed by %1$s."))]
|
||||
MsgChatDescriptionChangedBy = 241,
|
||||
}
|
||||
|
||||
impl StockMessage {
|
||||
@@ -601,6 +607,19 @@ pub(crate) async fn msg_grp_img_changed(context: &Context, by_contact: ContactId
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn msg_chat_description_changed(
|
||||
context: &Context,
|
||||
by_contact: ContactId,
|
||||
) -> String {
|
||||
if by_contact == ContactId::SELF {
|
||||
translated(context, StockMessage::MsgYouChangedDescription).await
|
||||
} else {
|
||||
translated(context, StockMessage::MsgChatDescriptionChangedBy)
|
||||
.await
|
||||
.replace1(&by_contact.get_stock_name(context).await)
|
||||
}
|
||||
}
|
||||
|
||||
/// Stock string: `You added member %1$s.` or `Member %1$s added by %2$s.`.
|
||||
///
|
||||
/// The `added_member_addr` parameter should be an email address and is looked up in the
|
||||
|
||||
Reference in New Issue
Block a user