Fix formatting not being parsed in incoming messages

This commit is contained in:
Tulir Asokan 2022-02-15 13:15:41 +02:00
parent e303a1decb
commit eee404c62d

View file

@ -1509,23 +1509,17 @@ func (portal *Portal) convertTextMessage(intent *appservice.IntentAPI, source *U
Body: msg.GetConversation(),
MsgType: event.MsgText,
}
var replyTo types.MessageID
var expiresIn uint32
extraAttrs := map[string]interface{}{}
if msg.GetExtendedTextMessage() != nil {
if len(msg.GetExtendedTextMessage().GetText()) > 0 {
content.Body = msg.GetExtendedTextMessage().GetText()
contextInfo := msg.GetExtendedTextMessage().GetContextInfo()
if contextInfo != nil {
portal.bridge.Formatter.ParseWhatsApp(content, contextInfo.GetMentionedJid())
replyTo = contextInfo.GetStanzaId()
}
expiresIn = contextInfo.GetExpiration()
extraAttrs["com.beeper.linkpreviews"] = portal.convertURLPreviewToBeeper(intent, source, msg.GetExtendedTextMessage())
}
contextInfo := msg.GetExtendedTextMessage().GetContextInfo()
portal.bridge.Formatter.ParseWhatsApp(content, contextInfo.GetMentionedJid())
replyTo := contextInfo.GetStanzaId()
expiresIn := contextInfo.GetExpiration()
extraAttrs := map[string]interface{}{}
extraAttrs["com.beeper.linkpreviews"] = portal.convertURLPreviewToBeeper(intent, source, msg.GetExtendedTextMessage())
return &ConvertedMessage{
Intent: intent,
Type: event.EventMessage,