event/reply: only remove plaintext reply fallback if there is one in HTML
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This commit is contained in:
Tulir Asokan 2025-11-08 09:49:15 +01:00
commit a973e5dc94

View file

@ -32,12 +32,13 @@ func TrimReplyFallbackText(text string) string {
}
func (content *MessageEventContent) RemoveReplyFallback() {
if len(content.RelatesTo.GetReplyTo()) > 0 && !content.replyFallbackRemoved {
if content.Format == FormatHTML {
content.FormattedBody = TrimReplyFallbackHTML(content.FormattedBody)
if len(content.RelatesTo.GetReplyTo()) > 0 && !content.replyFallbackRemoved && content.Format == FormatHTML {
origHTML := content.FormattedBody
content.FormattedBody = TrimReplyFallbackHTML(content.FormattedBody)
if content.FormattedBody != origHTML {
content.Body = TrimReplyFallbackText(content.Body)
content.replyFallbackRemoved = true
}
content.Body = TrimReplyFallbackText(content.Body)
content.replyFallbackRemoved = true
}
}