mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Do not ellipsize non-standard footers in chat messages
This commit is contained in:
@@ -44,7 +44,11 @@ pub fn simplify(mut input: String, is_chat_message: bool) -> (String, bool) {
|
|||||||
let original_lines = &lines;
|
let original_lines = &lines;
|
||||||
|
|
||||||
let lines = remove_message_footer(lines);
|
let lines = remove_message_footer(lines);
|
||||||
let (lines, mut has_nonstandard_footer) = remove_nonstandard_footer(lines);
|
let (lines, mut has_nonstandard_footer) = if !is_chat_message {
|
||||||
|
remove_nonstandard_footer(lines)
|
||||||
|
} else {
|
||||||
|
(lines, false)
|
||||||
|
};
|
||||||
let (lines, mut has_bottom_quote) = if !is_chat_message {
|
let (lines, mut has_bottom_quote) = if !is_chat_message {
|
||||||
remove_bottom_quote(lines)
|
remove_bottom_quote(lines)
|
||||||
} else {
|
} else {
|
||||||
@@ -223,6 +227,14 @@ mod tests {
|
|||||||
assert!(!is_forwarded);
|
assert!(!is_forwarded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_chat_message() {
|
||||||
|
let input = "Hi! How are you?\n\n---\n\nI am good.\n-- \nSent with my Delta Chat Messenger: https://delta.chat".to_string();
|
||||||
|
let (plain, is_forwarded) = simplify(input, true);
|
||||||
|
assert_eq!(plain, "Hi! How are you?\n\n---\n\nI am good.");
|
||||||
|
assert!(!is_forwarded);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simplify_trim() {
|
fn test_simplify_trim() {
|
||||||
let input = "line1\n\r\r\rline2".to_string();
|
let input = "line1\n\r\r\rline2".to_string();
|
||||||
|
|||||||
Reference in New Issue
Block a user