diff --git a/src/chat.rs b/src/chat.rs index 3e8f1ad7c..6e44cb8ff 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -761,14 +761,6 @@ impl ChatId { } } - let chat = Chat::load_from_db(context, self).await?; - if let Some(cant_send_reason) = chat.why_cant_send(context).await? { - bail!( - "Can't set a draft because chat is not writeable: {}", - cant_send_reason - ); - } - // set back draft information to allow identifying the draft later on - // no matter if message object is reused or reloaded from db msg.state = MessageState::OutDraft; diff --git a/src/tests/verified_chats.rs b/src/tests/verified_chats.rs index e2c40e2a8..5fb892c35 100644 --- a/src/tests/verified_chats.rs +++ b/src/tests/verified_chats.rs @@ -5,7 +5,7 @@ use crate::chat::{Chat, ProtectionStatus}; use crate::config::Config; use crate::contact::VerifiedStatus; use crate::contact::{Contact, Origin}; -use crate::message::Message; +use crate::message::{Message, Viewtype}; use crate::mimefactory::MimeFactory; use crate::mimeparser::SystemMessage; use crate::receive_imf::receive_imf; @@ -461,14 +461,21 @@ async fn test_break_protection_then_verify_again() -> Result<()> { tcm.send_recv(&bob_new, &alice, "I have a new device").await; assert_verified(&alice, &bob_new, ProtectionStatus::ProtectionBroken).await; - assert!( - !alice - .get_chat(&bob_new) - .await - .unwrap() - .can_send(&alice) - .await? - ); + + { + let alice_bob_chat = alice.get_chat(&bob_new).await.unwrap(); + assert!(!alice_bob_chat.can_send(&alice).await?); + + // Alice's UI should still be able to save a draft, which Alice started to type right when she got Bob's message: + let mut msg = Message::new(Viewtype::Text); + msg.set_text("Draftttt".to_string()); + alice_bob_chat.id.set_draft(&alice, Some(&mut msg)).await?; + assert_eq!( + alice_bob_chat.id.get_draft(&alice).await?.unwrap().text, + "Draftttt" + ); + } + tcm.execute_securejoin(&alice, &bob_new).await; assert_verified(&alice, &bob_new, ProtectionStatus::Protected).await;