mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 17:36:30 +03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user