Browse Source

Travis: Join rooms on Register()

kegan/text-logging
Kegan Dougal 8 years ago
parent
commit
9b55ba9963
  1. 13
      src/github.com/matrix-org/go-neb/services/travisci/travisci.go

13
src/github.com/matrix-org/go-neb/services/travisci/travisci.go

@ -245,6 +245,7 @@ func (s *Service) Register(oldService types.Service, client *matrix.Client) erro
} }
} }
} }
s.joinRooms(client)
return nil return nil
} }
@ -266,6 +267,18 @@ func (s *Service) PostRegister(oldService types.Service) {
} }
} }
func (s *Service) joinRooms(client *matrix.Client) {
for roomID := range s.Rooms {
if _, err := client.JoinRoom(roomID, "", ""); err != nil {
log.WithFields(log.Fields{
log.ErrorKey: err,
"room_id": roomID,
"user_id": client.UserID,
}).Error("Failed to join room")
}
}
}
func init() { func init() {
types.RegisterService(func(serviceID, serviceUserID, webhookEndpointURL string) types.Service { types.RegisterService(func(serviceID, serviceUserID, webhookEndpointURL string) types.Service {
return &Service{ return &Service{

Loading…
Cancel
Save