From fdacfc2f677b9a00b53a31ece44bbd2826023816 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 10 Jul 2024 23:50:41 +0300 Subject: [PATCH] v2: update mautrix-go --- cmd/mautrix-signal-v2/legacymigrate.sql | 3 +-- cmd/mautrix-signal-v2/main.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- pkg/connector/handlematrix.go | 7 ++----- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cmd/mautrix-signal-v2/legacymigrate.sql b/cmd/mautrix-signal-v2/legacymigrate.sql index 5e8c5ba4..eec71018 100644 --- a/cmd/mautrix-signal-v2/legacymigrate.sql +++ b/cmd/mautrix-signal-v2/legacymigrate.sql @@ -90,7 +90,7 @@ FROM puppet_old; INSERT INTO message ( bridge_id, id, part_id, mxid, room_id, room_receiver, - sender_id, timestamp, relates_to, metadata + sender_id, timestamp, metadata ) SELECT '', -- bridge_id @@ -104,7 +104,6 @@ SELECT END, -- room_receiver cast(sender AS TEXT), -- sender_id timestamp * 1000000, - NULL, -- relates_to '{}' -- metadata FROM message_old; diff --git a/cmd/mautrix-signal-v2/main.go b/cmd/mautrix-signal-v2/main.go index 80d2efc8..39a34969 100644 --- a/cmd/mautrix-signal-v2/main.go +++ b/cmd/mautrix-signal-v2/main.go @@ -51,7 +51,7 @@ func main() { 20, "v0.5.1", "v0.7.0", - m.LegacyMigrateSimple(legacyMigrateRenameTables, legacyMigrateCopyData, 4), + m.LegacyMigrateSimple(legacyMigrateRenameTables, legacyMigrateCopyData, 7), true, ) } diff --git a/go.mod b/go.mod index 8d629584..3f068ba3 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 golang.org/x/net v0.26.0 google.golang.org/protobuf v1.34.2 - maunium.net/go/mautrix v0.19.0-beta.1.0.20240709160900-fc7ed77e2630 + maunium.net/go/mautrix v0.19.0-beta.1.0.20240710204602-dd16a8d1d90b nhooyr.io/websocket v1.8.11 ) diff --git a/go.sum b/go.sum index 094f2d1f..a7c534ef 100644 --- a/go.sum +++ b/go.sum @@ -93,7 +93,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M= maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA= -maunium.net/go/mautrix v0.19.0-beta.1.0.20240709160900-fc7ed77e2630 h1:X+IuVExANBr0gfFQ22vpecvDzkiSCVAnFAYvyIZ+uOI= -maunium.net/go/mautrix v0.19.0-beta.1.0.20240709160900-fc7ed77e2630/go.mod h1:bNQrvIftiwJ+7OjSh+Gza5xcncq1ooHk6oyDWq4B4sg= +maunium.net/go/mautrix v0.19.0-beta.1.0.20240710204602-dd16a8d1d90b h1:xYEIkM0OzirvHPpTwYiDQrh6PHjDny5Ox84SIkD2aXc= +maunium.net/go/mautrix v0.19.0-beta.1.0.20240710204602-dd16a8d1d90b/go.mod h1:bNQrvIftiwJ+7OjSh+Gza5xcncq1ooHk6oyDWq4B4sg= nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0= nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= diff --git a/pkg/connector/handlematrix.go b/pkg/connector/handlematrix.go index 41b5ecd0..ea3475e1 100644 --- a/pkg/connector/handlematrix.go +++ b/pkg/connector/handlematrix.go @@ -101,9 +101,6 @@ func (s *SignalClient) HandleMatrixMessage(ctx context.Context, msg *bridgev2.Ma dbMsg.Metadata.Extra = map[string]any{ "contains_attachments": len(converted.Attachments) > 0, } - if msg.ReplyTo != nil { - dbMsg.RelatesToRowID = msg.ReplyTo.RowID - } return &bridgev2.MatrixMessageResponse{ DB: dbMsg, }, nil @@ -122,9 +119,9 @@ func (s *SignalClient) HandleMatrixEdit(ctx context.Context, msg *bridgev2.Matri Client: s, Portal: msg.Portal, } - if msg.EditTarget.RelatesToRowID != 0 { + if msg.EditTarget.ReplyTo.MessageID != "" { var err error - mcCtx.ReplyTo, err = s.Main.Bridge.DB.Message.GetByRowID(ctx, msg.EditTarget.RelatesToRowID) + mcCtx.ReplyTo, err = s.Main.Bridge.DB.Message.GetFirstOrSpecificPartByID(ctx, msg.Portal.Receiver, msg.EditTarget.ReplyTo) if err != nil { return fmt.Errorf("failed to get message reply target: %w", err) }