5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 19:40:25 +00:00

Linter fixes

This commit is contained in:
Duco van Amstel 2019-05-27 17:38:31 +01:00
parent 1b2feb19e5
commit 9619dff334
No known key found for this signature in database
GPG Key ID: F21407F360B6F333

View File

@ -167,25 +167,25 @@ func (m *MMClient) JoinChannel(channelId string) error { //nolint:golint
return nil return nil
} }
func (m *MMClient) UpdateChannelsTeam(teamId string) error { func (m *MMClient) UpdateChannelsTeam(teamID string) error {
mmchannels, resp := m.Client.GetChannelsForTeamForUser(teamId, m.User.Id, "") mmchannels, resp := m.Client.GetChannelsForTeamForUser(teamID, m.User.Id, "")
if resp.Error != nil { if resp.Error != nil {
return errors.New(resp.Error.DetailedError) return errors.New(resp.Error.DetailedError)
} }
for idx, t := range m.OtherTeams { for idx, t := range m.OtherTeams {
if t.Id == teamId { if t.Id == teamID {
m.Lock() m.Lock()
m.OtherTeams[idx].Channels = mmchannels m.OtherTeams[idx].Channels = mmchannels
m.Unlock() m.Unlock()
} }
} }
mmchannels, resp = m.Client.GetPublicChannelsForTeam(teamId, 0, 5000, "") mmchannels, resp = m.Client.GetPublicChannelsForTeam(teamID, 0, 5000, "")
if resp.Error != nil { if resp.Error != nil {
return errors.New(resp.Error.DetailedError) return errors.New(resp.Error.DetailedError)
} }
for idx, t := range m.OtherTeams { for idx, t := range m.OtherTeams {
if t.Id == teamId { if t.Id == teamID {
m.Lock() m.Lock()
m.OtherTeams[idx].MoreChannels = mmchannels m.OtherTeams[idx].MoreChannels = mmchannels
m.Unlock() m.Unlock()
@ -195,9 +195,13 @@ func (m *MMClient) UpdateChannelsTeam(teamId string) error {
} }
func (m *MMClient) UpdateChannels() error { func (m *MMClient) UpdateChannels() error {
m.UpdateChannelsTeam(m.Team.Id) if err := m.UpdateChannelsTeam(m.Team.Id); err != nil {
return err
}
for _, t := range m.OtherTeams { for _, t := range m.OtherTeams {
m.UpdateChannelsTeam(t.Id) if err := m.UpdateChannelsTeam(t.Id); err != nil {
return err
}
} }
return nil return nil
} }