fix: can_send(): Return false for protected 1:1 chat if contact isn't forward verified (#6222)

Otherwise if the user tries to send a message, that would just fail. `Chat::can_send()` returning
false makes the chat input field unavailable. A protected 1:1 chat with a not forward verified
contact may be a result of AEAP, the user should use the 1:1 chat with the new contact then.
This commit is contained in:
iequidoo
2024-11-20 19:37:19 -03:00
parent 4e798ceae1
commit 156fb6ffd5
2 changed files with 24 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
use anyhow::Result;
use crate::chat::{self, Chat, ChatId, ProtectionStatus};
use crate::chat::{self, CantSendReason, Chat, ChatId, ProtectionStatus};
use crate::contact;
use crate::contact::Contact;
use crate::contact::ContactId;
@@ -422,6 +422,11 @@ async fn test_write_to_alice_after_aeap() -> Result<()> {
assert!(chat::send_msg(bob, bob_alice_chat.id, &mut msg)
.await
.is_err());
assert!(!bob_alice_chat.can_send(bob).await?);
assert_eq!(
bob_alice_chat.why_cant_send(bob).await?,
Some(CantSendReason::NoForwardVerification)
);
// But encrypted communication is still possible in unprotected groups with old Alice.
let sent = bob