mirror of
https://github.com/chatmail/core.git
synced 2026-05-21 15:56:30 +03:00
"full message view" not needed because of footers
standard footers meanwhile go the "contact status", so they are no longer a reason to trigger "full message view". this was already discussed when the HTML view was introduced at #2125 however, forgotten to change when the "contact status" was added at #2218 this pr will result in a cleaner chat view with less "Show Full Message..." buttons and will also save some storage (in fact, i came over that when reviewing #4129 )
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
- Drop unused SQL columns #4141
|
- Drop unused SQL columns #4141
|
||||||
|
- "full message view" not needed because of footers that go to contact status #4151
|
||||||
|
|
||||||
|
|
||||||
## 1.111.0
|
## 1.111.0
|
||||||
|
|||||||
@@ -2085,9 +2085,11 @@ Original signature",
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let one2one_chat_id = t.get_last_msg().await.chat_id;
|
let msg = t.get_last_msg().await;
|
||||||
|
let one2one_chat_id = msg.chat_id;
|
||||||
let bob = Contact::load_from_db(&t, bob_id).await?;
|
let bob = Contact::load_from_db(&t, bob_id).await?;
|
||||||
assert_eq!(bob.get_status(), "Original signature");
|
assert_eq!(bob.get_status(), "Original signature");
|
||||||
|
assert!(!msg.has_html());
|
||||||
|
|
||||||
receive_imf(
|
receive_imf(
|
||||||
&t,
|
&t,
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ pub(crate) struct SimplifiedText {
|
|||||||
/// True if the message is forwarded.
|
/// True if the message is forwarded.
|
||||||
pub is_forwarded: bool,
|
pub is_forwarded: bool,
|
||||||
|
|
||||||
/// True if nonstandard footer was removed.
|
/// True if nonstandard footer was removed
|
||||||
|
/// or if the message contains quotes other than `top_quote`.
|
||||||
pub is_cut: bool,
|
pub is_cut: bool,
|
||||||
|
|
||||||
/// Top quote, if any.
|
/// Top quote, if any.
|
||||||
@@ -103,7 +104,6 @@ pub(crate) fn simplify(mut input: String, is_chat_message: bool) -> SimplifiedTe
|
|||||||
let original_lines = &lines;
|
let original_lines = &lines;
|
||||||
let (lines, footer_lines) = remove_message_footer(lines);
|
let (lines, footer_lines) = remove_message_footer(lines);
|
||||||
let footer = footer_lines.map(|footer_lines| render_message(footer_lines, false));
|
let footer = footer_lines.map(|footer_lines| render_message(footer_lines, false));
|
||||||
is_cut = is_cut || footer.is_some();
|
|
||||||
|
|
||||||
let text = if is_chat_message {
|
let text = if is_chat_message {
|
||||||
render_message(lines, false)
|
render_message(lines, false)
|
||||||
@@ -330,7 +330,7 @@ mod tests {
|
|||||||
} = simplify(input, true);
|
} = simplify(input, true);
|
||||||
assert_eq!(text, "Hi! How are you?\n\n---\n\nI am good.");
|
assert_eq!(text, "Hi! How are you?\n\n---\n\nI am good.");
|
||||||
assert!(!is_forwarded);
|
assert!(!is_forwarded);
|
||||||
assert!(is_cut);
|
assert!(!is_cut);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
footer.unwrap(),
|
footer.unwrap(),
|
||||||
"Sent with my Delta Chat Messenger: https://delta.chat"
|
"Sent with my Delta Chat Messenger: https://delta.chat"
|
||||||
@@ -365,7 +365,7 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(text, "Forwarded message");
|
assert_eq!(text, "Forwarded message");
|
||||||
assert!(is_forwarded);
|
assert!(is_forwarded);
|
||||||
assert!(is_cut);
|
assert!(!is_cut);
|
||||||
assert_eq!(footer.unwrap(), "Signature goes here");
|
assert_eq!(footer.unwrap(), "Signature goes here");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ mod tests {
|
|||||||
..
|
..
|
||||||
} = simplify(input, true);
|
} = simplify(input, true);
|
||||||
assert_eq!(text, "text\n\n--\nno footer");
|
assert_eq!(text, "text\n\n--\nno footer");
|
||||||
assert!(is_cut);
|
assert!(!is_cut);
|
||||||
assert_eq!(footer.unwrap(), "footer");
|
assert_eq!(footer.unwrap(), "footer");
|
||||||
|
|
||||||
let input = "text\n\n--\ntreated as footer when unescaped".to_string();
|
let input = "text\n\n--\ntreated as footer when unescaped".to_string();
|
||||||
@@ -453,7 +453,7 @@ mod tests {
|
|||||||
..
|
..
|
||||||
} = simplify(input.clone(), true);
|
} = simplify(input.clone(), true);
|
||||||
assert_eq!(text, "text"); // see remove_message_footer() for some explanations
|
assert_eq!(text, "text"); // see remove_message_footer() for some explanations
|
||||||
assert!(is_cut);
|
assert!(!is_cut);
|
||||||
assert_eq!(footer.unwrap(), "treated as footer when unescaped");
|
assert_eq!(footer.unwrap(), "treated as footer when unescaped");
|
||||||
let escaped = escape_message_footer_marks(&input);
|
let escaped = escape_message_footer_marks(&input);
|
||||||
let SimplifiedText {
|
let SimplifiedText {
|
||||||
@@ -495,7 +495,7 @@ mod tests {
|
|||||||
..
|
..
|
||||||
} = simplify(input.clone(), true);
|
} = simplify(input.clone(), true);
|
||||||
assert_eq!(text, ""); // see remove_message_footer() for some explanations
|
assert_eq!(text, ""); // see remove_message_footer() for some explanations
|
||||||
assert!(is_cut);
|
assert!(!is_cut);
|
||||||
assert_eq!(footer.unwrap(), "treated as footer when unescaped");
|
assert_eq!(footer.unwrap(), "treated as footer when unescaped");
|
||||||
|
|
||||||
let escaped = escape_message_footer_marks(&input);
|
let escaped = escape_message_footer_marks(&input);
|
||||||
|
|||||||
Reference in New Issue
Block a user