Skip to content

Commit

Permalink
Fix allowed room list not working with aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
silkeh committed Aug 7, 2022
1 parent b8bba2d commit 83d918e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/gorilla/mux v1.8.0
github.com/prometheus/alertmanager v0.23.0
github.com/prometheus/client_golang v1.12.1
gitlab.com/silkeh/matrix-bot v0.0.0-20220108152249-8b2d6ecea043
gitlab.com/silkeh/matrix-bot v0.1.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
gitlab.com/silkeh/matrix-bot v0.0.0-20220108152249-8b2d6ecea043 h1:UBARlLXJ4YlmE+r7TQalnvsaail8AZcUdVEZq+sEfxk=
gitlab.com/silkeh/matrix-bot v0.0.0-20220108152249-8b2d6ecea043/go.mod h1:BDSjkfO7UAoFDktPwlC1ASQJCESjEfbbI6FmtRce6NY=
gitlab.com/silkeh/matrix-bot v0.1.0 h1:baiwhVjb/ay4xwwpi5G1I9IXjtvgZsRyQgh8WzimrbY=
gitlab.com/silkeh/matrix-bot v0.1.0/go.mod h1:BDSjkfO7UAoFDktPwlC1ASQJCESjEfbbI6FmtRce6NY=
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
Expand Down
9 changes: 6 additions & 3 deletions pkg/bot/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/prometheus/alertmanager/pkg/labels"
"github.com/prometheus/alertmanager/types"

bot "gitlab.com/silkeh/matrix-bot"

"github.com/silkeh/alertmanager_matrix/pkg/alertmanager"
Expand Down Expand Up @@ -182,11 +183,13 @@ func (c *Client) Run() error {

// joinRooms joins a list of room IDs or aliases.
func (c *Client) joinRooms(roomList []string) error {
for _, r := range roomList {
err := c.Matrix.NewRoom(r).Join()
for i, r := range roomList {
id, err := c.Matrix.NewRoom(r).Join()
if err != nil {
return fmt.Errorf("cannot join room: %w", err)
return fmt.Errorf("cannot join room %q: %w", r, err)
}

roomList[i] = id
}

return nil
Expand Down

0 comments on commit 83d918e

Please sign in to comment.