automatically ignore known forwarded addresses, fixes #64

This commit is contained in:
Aine
2023-09-18 12:35:37 +03:00
parent e90925eceb
commit 60b4386dd8
187 changed files with 4070 additions and 2667 deletions

View File

@@ -11,8 +11,6 @@ import (
"regexp"
"strings"
"golang.org/x/net/html"
"maunium.net/go/mautrix/id"
)
@@ -23,7 +21,7 @@ func TrimReplyFallbackHTML(html string) string {
}
func TrimReplyFallbackText(text string) string {
if !strings.HasPrefix(text, "> ") || !strings.Contains(text, "\n") {
if (!strings.HasPrefix(text, "> <") && !strings.HasPrefix(text, "> * <")) || !strings.Contains(text, "\n") {
return text
}
@@ -59,7 +57,7 @@ func (evt *Event) GenerateReplyFallbackHTML() string {
parsedContent.RemoveReplyFallback()
body := parsedContent.FormattedBody
if len(body) == 0 {
body = strings.ReplaceAll(html.EscapeString(parsedContent.Body), "\n", "<br/>")
body = TextToHTML(parsedContent.Body)
}
senderDisplayName := evt.Sender