refactor: MimeFactory::is_e2ee_guaranteed(): always respect Param::ForcePlaintext

Even if a chat is protected, `Param::ForcePlaintext` in fact disables e2ee. Reflect this behaviour
in `MimeFactory::is_e2ee_guaranteed()`.
This commit is contained in:
iequidoo
2024-06-26 14:38:48 -03:00
committed by iequidoo
parent ce44312ac0
commit 4ed9c04e9b

View File

@@ -286,14 +286,11 @@ impl MimeFactory {
fn is_e2ee_guaranteed(&self) -> bool {
match &self.loaded {
Loaded::Message { chat, msg } => {
if chat.is_protected() {
return true;
}
!msg.param
.get_bool(Param::ForcePlaintext)
.unwrap_or_default()
&& msg.param.get_bool(Param::GuaranteeE2ee).unwrap_or_default()
&& (chat.is_protected()
|| msg.param.get_bool(Param::GuaranteeE2ee).unwrap_or_default())
}
Loaded::Mdn { .. } => false,
}