Skip to content

Commit

Permalink
Include caption text from XMA attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Mar 4, 2024
1 parent b7230c1 commit b763dce
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions msgconv/from-meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,22 @@ func (mc *MessageConverter) xmaAttachmentToMatrix(ctx context.Context, att *tabl
converted.Extra["external_url"] = removeLPHP(att.CTA.ActionUrl)
}
parts := []*ConvertedMessagePart{converted}
if att.TitleText != "" {
if att.TitleText != "" || att.CaptionBodyText != "" {
captionContent := &event.MessageEventContent{
MsgType: event.MsgText,
}
if att.TitleText != "" {
captionContent.Body = trimPostTitle(att.TitleText, int(att.MaxTitleNumOfLines))
}
if att.CaptionBodyText != "" {
if captionContent.Body != "" {
captionContent.Body += "\n\n"
}
captionContent.Body += att.CaptionBodyText
}
parts = append(parts, &ConvertedMessagePart{
Type: event.EventMessage,
Content: &event.MessageEventContent{
MsgType: event.MsgText,
Body: trimPostTitle(att.TitleText, int(att.MaxTitleNumOfLines)),
},
Type: event.EventMessage,
Content: captionContent,
Extra: map[string]any{
"com.beeper.meta.full_post_title": att.TitleText,
},
Expand Down

0 comments on commit b763dce

Please sign in to comment.