Fix bridge no longer POSTing username and avatar (slack) (#536)

* Fixed pointer/reference issue in populateUsers. [#536]

* Accepted codestyle suggestion.

* Update bridge/slack/helpers.go

Co-Authored-By: patcon <patrick.c.connolly@gmail.com>

* Update helpers.go
This commit is contained in:
Patrick Connolly 2018-10-25 03:12:20 +08:00 committed by Wim
parent 291594b99c
commit d379118772

View File

@ -65,8 +65,10 @@ func (b *Bslack) populateUsers() {
} }
newUsers := map[string]*slack.User{} newUsers := map[string]*slack.User{}
for _, user := range users { for i := range users {
newUsers[user.ID] = &user // Use array index for pointer, not the copy
// See: https://stackoverflow.com/a/29498133/504018
newUsers[users[i].ID] = &users[i]
} }
b.usersMutex.Lock() b.usersMutex.Lock()