Browse Source

Keep doing the Inviter hack when joining rooms so non-ops can kick the bot they invited

pull/137/head
Kegan Dougal 8 years ago
parent
commit
efe04d7917
  1. 6
      src/github.com/matrix-org/go-neb/clients/clients.go
  2. 2
      src/github.com/matrix-org/go-neb/services/github/github_webhook.go
  3. 2
      src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go
  4. 2
      src/github.com/matrix-org/go-neb/services/travisci/travisci.go

6
src/github.com/matrix-org/go-neb/clients/clients.go

@ -311,7 +311,11 @@ func (c *Clients) onRoomMemberEvent(client *gomatrix.Client, event *gomatrix.Eve
})
logger.Print("Accepting invite from user")
if _, err := client.JoinRoom(event.RoomID, "", event.Sender); err != nil {
content := struct {
Inviter string `json:"inviter"`
}{event.Sender}
if _, err := client.JoinRoom(event.RoomID, "", content); err != nil {
logger.WithError(err).Print("Failed to join room")
} else {
logger.Print("Joined room")

2
src/github.com/matrix-org/go-neb/services/github/github_webhook.go

@ -253,7 +253,7 @@ func (s *WebhookService) PostRegister(oldService types.Service) {
func (s *WebhookService) joinWebhookRooms(client *gomatrix.Client) error {
for roomID := range s.Rooms {
if _, err := client.JoinRoom(roomID, "", ""); err != nil {
if _, err := client.JoinRoom(roomID, "", nil); err != nil {
// TODO: Leave the rooms we successfully joined?
return err
}

2
src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

@ -109,7 +109,7 @@ func (s *Service) joinRooms(client *gomatrix.Client) {
}
for roomID := range roomSet {
if _, err := client.JoinRoom(roomID, "", ""); err != nil {
if _, err := client.JoinRoom(roomID, "", nil); err != nil {
log.WithFields(log.Fields{
log.ErrorKey: err,
"room_id": roomID,

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

@ -275,7 +275,7 @@ func (s *Service) PostRegister(oldService types.Service) {
func (s *Service) joinRooms(client *gomatrix.Client) {
for roomID := range s.Rooms {
if _, err := client.JoinRoom(roomID, "", ""); err != nil {
if _, err := client.JoinRoom(roomID, "", nil); err != nil {
log.WithFields(log.Fields{
log.ErrorKey: err,
"room_id": roomID,

Loading…
Cancel
Save