diff --git a/shell/matrix/client.go b/shell/matrix/client.go index 7155d49..454ac54 100644 --- a/shell/matrix/client.go +++ b/shell/matrix/client.go @@ -276,7 +276,7 @@ func (c *Client) SendText(ctx context.Context, roomID, text string) error { // FormattedBody contains the HTML rendered by goldmark. func (c *Client) SendMarkdown(ctx context.Context, roomID, markdown string) error { html := mdToHTML(markdown) - content := event.MessageEventContent{ + content := &event.MessageEventContent{ MsgType: event.MsgText, Body: markdown, Format: event.FormatHTML, @@ -309,7 +309,7 @@ func mdToHTML(md string) string { // It sets m.in_reply_to so Matrix clients show the original message as a quote. func (c *Client) SendReplyMarkdown(ctx context.Context, roomID, inReplyTo, markdown string) error { html := mdToHTML(markdown) - content := event.MessageEventContent{ + content := &event.MessageEventContent{ MsgType: event.MsgText, Body: markdown, Format: event.FormatHTML, @@ -329,7 +329,10 @@ func (c *Client) SendThreadMarkdown(ctx context.Context, roomID, threadRootID, i inReplyTo = threadRootID } html := mdToHTML(markdown) - content := event.MessageEventContent{ + // Must use a pointer so mautrix-go can call OptionalGetRelatesTo() (pointer receiver) + // and copy m.relates_to to the outer m.room.encrypted event. Without this, Element + // Web does not see the thread relationship and shows the reply in the main timeline. + content := &event.MessageEventContent{ MsgType: event.MsgText, Body: markdown, Format: event.FormatHTML,