Skip to content

Commit

Permalink
v2: update mautrix-go
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 10, 2024
1 parent 4fd3777 commit fdacfc2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions cmd/mautrix-signal-v2/legacymigrate.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -104,7 +104,6 @@ SELECT
END, -- room_receiver
cast(sender AS TEXT), -- sender_id
timestamp * 1000000,
NULL, -- relates_to
'{}' -- metadata
FROM message_old;

Expand Down
2 changes: 1 addition & 1 deletion cmd/mautrix-signal-v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func main() {
20,
"v0.5.1",
"v0.7.0",
m.LegacyMigrateSimple(legacyMigrateRenameTables, legacyMigrateCopyData, 4),
m.LegacyMigrateSimple(legacyMigrateRenameTables, legacyMigrateCopyData, 7),
true,
)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
7 changes: 2 additions & 5 deletions pkg/connector/handlematrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down

0 comments on commit fdacfc2

Please sign in to comment.