Propagate encryption_mode from Chat to Message

This commit is contained in:
jikstra
2022-11-18 02:44:02 +01:00
parent a714a4c2da
commit d8844a0524

View File

@@ -1998,6 +1998,14 @@ pub async fn is_contact_in_chat(
// the caller can get it from msg.chat_id. Forwards would need to
// be fixed for this somehow too.
pub async fn send_msg(context: &Context, chat_id: ChatId, msg: &mut Message) -> Result<MsgId> {
// Propagate same encryption_mode of chat to message in case messages doesn't yet have an
// encryption_mode
if let None = msg.get_encryption_modus(&context).await? {
if let Some(encryption_mode) = chat_id.get_encryption_modus(&context).await? {
msg.set_encryption_modus(&context, encryption_mode);
}
}
if chat_id.is_unset() {
let forwards = msg.param.get(Param::PrepForwards);
if let Some(forwards) = forwards {