Skip to content

Commit

Permalink
Merge branch 'main' into spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Oct 2, 2023
2 parents 5bf8fb4 + 4530ff3 commit b44d5c1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config.yaml
slack
logs/
mautrix-slack.db
*.db*
registration.yaml
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ require (
maunium.net/go/mauflag v1.0.0 // indirect
)

replace github.com/slack-go/slack => github.com/beeper/slackgo v0.0.0-20230529112042-04e062c05e8b
replace github.com/slack-go/slack => github.com/beeper/slackgo v0.11.3-0.20230919144304-36e35976c9c3
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/beeper/slackgo v0.0.0-20230529112042-04e062c05e8b h1:SCBqU2C4ka1BZigu025aZGsTL62oJdlQFRWmzE/nWXg=
github.com/beeper/slackgo v0.0.0-20230529112042-04e062c05e8b/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw=
github.com/beeper/slackgo v0.11.3-0.20230919144304-36e35976c9c3 h1:jtszdZhFmxxstuHffDZ3r5SKtRQ4uHanv8+ODgCmArc=
github.com/beeper/slackgo v0.11.3-0.20230919144304-36e35976c9c3/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
20 changes: 13 additions & 7 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ func (user *User) LogoutUserTeam(userTeam *database.UserTeam) error {
}
}

if _, err := userTeam.Client.SendAuthSignout(); err != nil {
user.log.Errorfln("Failed to send auth.signout request to Slack! %v", err)
}

userTeam.Client = nil

user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateLoggedOut})
Expand Down Expand Up @@ -404,15 +408,17 @@ func (user *User) slackMessageHandler(userTeam *database.UserTeam) {
userTeam.Upsert()

user.tryAutomaticDoublePuppeting(userTeam)
user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateBackfilling})

user.log.Infofln("connected to team %s as %s", userTeam.TeamName, userTeam.SlackEmail)

portals := user.bridge.dbPortalsToPortals(user.bridge.DB.Portal.GetAllForUserTeam(userTeam.Key))
for _, portal := range portals {
err := portal.ForwardBackfill()
if err != nil {
user.log.Warnfln("Forward backfill for portal %s failed: %v", portal.Key, err)
if user.bridge.Config.Bridge.Backfill.Enable {
user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateBackfilling})

portals := user.bridge.dbPortalsToPortals(user.bridge.DB.Portal.GetAllForUserTeam(userTeam.Key))
for _, portal := range portals {
err := portal.ForwardBackfill()
if err != nil {
user.log.Warnfln("Forward backfill for portal %s failed: %v", portal.Key, err)
}
}
}
user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateConnected})
Expand Down

0 comments on commit b44d5c1

Please sign in to comment.