merge: quick/fix-thread-send-pointer — fix m.relates_to en eventos cifrados de thread
Corrige el bug por el que el agente enviaba respuestas de thread sin m.relates_to en el evento m.room.encrypted exterior. mautrix-go usaba getRelatesTo() que requiere pointer receiver, pero se pasaba el content por valor. Element Web no podia detectar la relacion de thread y mostraba la respuesta en la timeline principal.
This commit is contained in:
@@ -276,7 +276,7 @@ func (c *Client) SendText(ctx context.Context, roomID, text string) error {
|
|||||||
// FormattedBody contains the HTML rendered by goldmark.
|
// FormattedBody contains the HTML rendered by goldmark.
|
||||||
func (c *Client) SendMarkdown(ctx context.Context, roomID, markdown string) error {
|
func (c *Client) SendMarkdown(ctx context.Context, roomID, markdown string) error {
|
||||||
html := mdToHTML(markdown)
|
html := mdToHTML(markdown)
|
||||||
content := event.MessageEventContent{
|
content := &event.MessageEventContent{
|
||||||
MsgType: event.MsgText,
|
MsgType: event.MsgText,
|
||||||
Body: markdown,
|
Body: markdown,
|
||||||
Format: event.FormatHTML,
|
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.
|
// 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 {
|
func (c *Client) SendReplyMarkdown(ctx context.Context, roomID, inReplyTo, markdown string) error {
|
||||||
html := mdToHTML(markdown)
|
html := mdToHTML(markdown)
|
||||||
content := event.MessageEventContent{
|
content := &event.MessageEventContent{
|
||||||
MsgType: event.MsgText,
|
MsgType: event.MsgText,
|
||||||
Body: markdown,
|
Body: markdown,
|
||||||
Format: event.FormatHTML,
|
Format: event.FormatHTML,
|
||||||
@@ -329,7 +329,10 @@ func (c *Client) SendThreadMarkdown(ctx context.Context, roomID, threadRootID, i
|
|||||||
inReplyTo = threadRootID
|
inReplyTo = threadRootID
|
||||||
}
|
}
|
||||||
html := mdToHTML(markdown)
|
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,
|
MsgType: event.MsgText,
|
||||||
Body: markdown,
|
Body: markdown,
|
||||||
Format: event.FormatHTML,
|
Format: event.FormatHTML,
|
||||||
|
|||||||
Reference in New Issue
Block a user