Compare commits

...

1 Commits

Author SHA1 Message Date
link2xt
3145768fed Use the message text as the initial subject 2023-02-14 11:01:56 +00:00
4 changed files with 5 additions and 19 deletions

View File

@@ -3,6 +3,7 @@
## Unreleased
### Changes
- Use message text as the initial subject for 1:1 contacts. #4036
### Fixes

View File

@@ -38,9 +38,6 @@ by the [Protected Headers](https://tools.ietf.org/id/draft-autocrypt-lamps-prote
# Outgoing messages
Messengers MUST add a `Chat-Version: 1.0` header to outgoing messages.
For filtering and smart appearance of the messages in normal MUAs,
the `Subject` header SHOULD be `Message from <sender name>`.
Replies to messages MAY follow the typical `Re:`-format.
The body MAY contain text which MUST have the content type `text/plain`
or `mulipart/alternative` containing `text/plain`.

View File

@@ -28,7 +28,7 @@ use crate::stock_str;
use crate::tools::IsNoneOrEmpty;
use crate::tools::{
create_outgoing_rfc724_mid, create_smeared_timestamp, get_filebytes, remove_subject_prefix,
time,
time, truncate,
};
// attachments of 25 mb brutto should work on the majority of providers
@@ -435,11 +435,7 @@ impl<'a> MimeFactory<'a> {
}
}
let self_name = &match context.get_config(Config::Displayname).await? {
Some(name) => name,
None => context.get_config(Config::Addr).await?.unwrap_or_default(),
};
stock_str::subject_for_new_contact(context, self_name).await
truncate(self.msg.text.as_deref().unwrap_or_default().trim(), 40).to_string()
}
Loaded::Mdn { .. } => stock_str::read_rcpt(context).await,
};
@@ -1669,13 +1665,13 @@ mod tests {
// 3. Send the first message to a new contact
let t = TestContext::new_alice().await;
assert_eq!(first_subject_str(t).await, "Message from alice@example.org");
assert_eq!(first_subject_str(t).await, "Hi");
let t = TestContext::new_alice().await;
t.set_config(Config::Displayname, Some("Alice"))
.await
.unwrap();
assert_eq!(first_subject_str(t).await, "Message from Alice");
assert_eq!(first_subject_str(t).await, "Hi");
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]

View File

@@ -868,14 +868,6 @@ pub(crate) async fn unknown_sender_for_chat(context: &Context) -> String {
translated(context, StockMessage::UnknownSenderForChat).await
}
/// Stock string: `Message from %1$s`.
// TODO: This can compute `self_name` itself instead of asking the caller to do this.
pub(crate) async fn subject_for_new_contact(context: &Context, self_name: &str) -> String {
translated(context, StockMessage::SubjectForNewContact)
.await
.replace1(self_name)
}
/// Stock string: `Failed to send message to %1$s.`.
pub(crate) async fn failed_sending_to(context: &Context, name: &str) -> String {
translated(context, StockMessage::FailedSendingTo)