summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-03 15:17:34 -0500
committerGitHub <noreply@github.com>2017-02-03 15:17:34 -0500
commit7ff2aef7facdeb025a1651ef411fceb3d81932c1 (patch)
tree7ea2f7b89e4b4c1acf3ca021377b0166089ba397 /app/channel.go
parent948b557453550646ad3213cb4144055eb7db0d69 (diff)
downloadchat-7ff2aef7facdeb025a1651ef411fceb3d81932c1.tar.gz
chat-7ff2aef7facdeb025a1651ef411fceb3d81932c1.tar.bz2
chat-7ff2aef7facdeb025a1651ef411fceb3d81932c1.zip
Implement GET /users endpoint for APIv4 (#5277)
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/channel.go b/app/channel.go
index 02124f3c8..3609a36b7 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -404,22 +404,20 @@ func AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelM
}
func AddDirectChannels(teamId string, user *model.User) *model.AppError {
- var profiles map[string]*model.User
+ var profiles []*model.User
if result := <-Srv.Store.User().GetProfiles(teamId, 0, 100); result.Err != nil {
return model.NewLocAppError("AddDirectChannels", "api.user.add_direct_channels_and_forget.failed.error", map[string]interface{}{"UserId": user.Id, "TeamId": teamId, "Error": result.Err.Error()}, "")
} else {
- profiles = result.Data.(map[string]*model.User)
+ profiles = result.Data.([]*model.User)
}
var preferences model.Preferences
- for id := range profiles {
- if id == user.Id {
+ for _, profile := range profiles {
+ if profile.Id == user.Id {
continue
}
- profile := profiles[id]
-
preference := model.Preference{
UserId: user.Id,
Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW,