Skip to content

Commit

Permalink
msgconv/from-meta: ignore non-story reply snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 12, 2025
1 parent 0fffc12 commit ec7e79c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/msgconv/from-meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ func (mc *MessageConverter) ToMatrix(
for _, sticker := range msg.Stickers {
cm.Parts = append(cm.Parts, mc.stickerToMatrix(ctx, sticker))
}
if msg.Text != "" || msg.ReplySnippet != "" || len(urlPreviews) > 0 {
hasRelationSnippet := msg.ReplySnippet != "" && len(msg.XMAAttachments) > 0 && len(msg.XMAAttachments) != len(urlPreviews)
if msg.Text != "" || hasRelationSnippet || len(urlPreviews) > 0 {
mentions := &socket.MentionData{
MentionIDs: msg.MentionIds,
MentionOffsets: msg.MentionOffsets,
Expand All @@ -138,7 +139,7 @@ func (mc *MessageConverter) ToMatrix(
}
}
extra := make(map[string]any)
if msg.ReplySnippet != "" && len(msg.XMAAttachments) > 0 && len(msg.XMAAttachments) != len(urlPreviews) {
if hasRelationSnippet {
extra["com.beeper.relation_snippet"] = msg.ReplySnippet
// This is extremely hacky
isReaction := strings.Contains(msg.ReplySnippet, "Reacted")
Expand Down

0 comments on commit ec7e79c

Please sign in to comment.