Skip to content

Commit

Permalink
backfill: update mautrix-go to enable backfill queue
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 18, 2024
1 parent 0c34dc8 commit e9ae3d9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/yuin/goldmark v1.7.4
go.mau.fi/util v0.6.0
gopkg.in/yaml.v3 v3.0.1
maunium.net/go/mautrix v0.19.1-0.20240716143345-128781cffe32
maunium.net/go/mautrix v0.19.1-0.20240718145320-910e3ee771c7
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ 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.1-0.20240716143345-128781cffe32 h1:Fp66lJVh5+PjYqpuETGZKKVWUWUh9jHIS0iC8hJ4174=
maunium.net/go/mautrix v0.19.1-0.20240716143345-128781cffe32/go.mod h1:UE+mSQ4sDUuJMbjN0aB9EjQSGgXd48AzMvZ6+QJV1k8=
maunium.net/go/mautrix v0.19.1-0.20240718145320-910e3ee771c7 h1:0tcsCZnuvoag31LuUPJLKIOlLdPh8KjIUwlDY7oXiIs=
maunium.net/go/mautrix v0.19.1-0.20240718145320-910e3ee771c7/go.mod h1:UE+mSQ4sDUuJMbjN0aB9EjQSGgXd48AzMvZ6+QJV1k8=
3 changes: 3 additions & 0 deletions pkg/connector/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import (
var _ bridgev2.BackfillingNetworkAPI = (*SlackClient)(nil)

func (s *SlackClient) FetchMessages(ctx context.Context, params bridgev2.FetchMessagesParams) (*bridgev2.FetchMessagesResponse, error) {
if s.Client == nil {
return nil, fmt.Errorf("not logged in")
}
_, channelID := slackid.ParsePortalID(params.Portal.ID)
if channelID == "" {
return nil, fmt.Errorf("invalid channel ID")
Expand Down
1 change: 1 addition & 0 deletions pkg/connector/chatinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ func (s *SlackClient) wrapChatInfo(ctx context.Context, info *slack.Channel, fet
Type: &roomType,
ParentID: ptr.Ptr(slackid.MakeTeamPortalID(s.TeamID)),
ExtraUpdates: extraUpdates,
CanBackfill: true,
}, nil
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/connector/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ func (s *SlackClient) SyncChannels(ctx context.Context) {
Type: bridgev2.RemoteEventChatResync,
PortalKey: portalKey,
CreatePortal: hasCounts || !(ch.IsIM || ch.IsMpIM),
LogContext: func(c zerolog.Context) zerolog.Context {
return c.
Object("portal_key", portalKey).
Str("slack_latest_message_id", latestMessageID)
},
},
Client: s,
LatestMessage: latestMessageID,
Expand Down

0 comments on commit e9ae3d9

Please sign in to comment.