events: Be a little smarter when removing plain reply fallback
Given that the default algorithm from the spec would also remove the beginning of a message starting with a blockquote, let's be more conservative an check that the beginning really looks like the fallback that was defined in the spec.
This commit is contained in:
parent
f05d0e03a1
commit
81611b65f8
@ -4,7 +4,10 @@
|
||||
///
|
||||
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies
|
||||
pub fn remove_plain_reply_fallback(mut s: &str) -> &str {
|
||||
if !s.starts_with("> ") {
|
||||
// A reply fallback must begin with a mention of the original sender between `<` and `>`, and
|
||||
// emotes add `*` as a prefix. If there is no newline, removing the detected fallback would
|
||||
// result in an empty string.
|
||||
if (!s.starts_with("> <") && !s.starts_with("> * <")) || !s.contains('\n') {
|
||||
return s;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user