Add notice to messages that contain components

This commit is contained in:
Tulir Asokan
2023-01-29 15:36:53 +02:00
parent dd29e8edf5
commit 0f32f966b3

View File

@@ -917,6 +917,8 @@ const msgInteractionTemplateHTML = `<blockquote>
<a href="https://matrix.to/#/%s">%s</a> used <font color="#3771bb">/%s</font>
</blockquote>`
const msgComponentTemplateHTML = `<p>This message contains interactive elements. Use the Discord app to interact with the message.</p>`
func (portal *Portal) convertDiscordTextMessage(intent *appservice.IntentAPI, msg *discordgo.Message, relation *event.RelatesTo, isEdit bool) *ConvertedMessage {
var htmlParts []string
if msg.Interaction != nil {
@@ -941,6 +943,10 @@ func (portal *Portal) convertDiscordTextMessage(intent *appservice.IntentAPI, ms
}
}
if len(msg.Components) > 0 {
htmlParts = append(htmlParts, msgComponentTemplateHTML)
}
if len(htmlParts) == 0 {
return nil
}