From 9b55ba9963cce0458b63e6494621157c062bd9e4 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 17 Nov 2016 11:18:27 +0000 Subject: [PATCH] Travis: Join rooms on Register() --- .../matrix-org/go-neb/services/travisci/travisci.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go index 8185794..543b9d6 100644 --- a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go +++ b/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 } @@ -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() { types.RegisterService(func(serviceID, serviceUserID, webhookEndpointURL string) types.Service { return &Service{