From d379118772aa68d0b35bb5a98b5600dc81a89197 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Thu, 25 Oct 2018 03:12:20 +0800 Subject: 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 * Update helpers.go --- bridge/slack/helpers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bridge') diff --git a/bridge/slack/helpers.go b/bridge/slack/helpers.go index 18dded3b..8508d152 100644 --- a/bridge/slack/helpers.go +++ b/bridge/slack/helpers.go @@ -65,8 +65,10 @@ func (b *Bslack) populateUsers() { } newUsers := map[string]*slack.User{} - for _, user := range users { - newUsers[user.ID] = &user + for i := range users { + // Use array index for pointer, not the copy + // See: https://stackoverflow.com/a/29498133/504018 + newUsers[users[i].ID] = &users[i] } b.usersMutex.Lock() -- cgit v1.2.3