summaryrefslogtreecommitdiffstats
path: root/app/user.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-03-13 13:36:23 +0000
committerGeorge Goldberg <george@gberg.me>2018-03-13 13:36:23 +0000
commitfadcdd271a68b38571b75d1d38ab023f940ac83a (patch)
tree7f413edd35401b54b2f4eb4a687da1ac273bcd4b /app/user.go
parentb66e4bc932ed76c1cfd2b5f4ec0cfce70cd9fbb4 (diff)
parentf2d26801b9647715fb43af873354d8def753868b (diff)
downloadchat-fadcdd271a68b38571b75d1d38ab023f940ac83a.tar.gz
chat-fadcdd271a68b38571b75d1d38ab023f940ac83a.tar.bz2
chat-fadcdd271a68b38571b75d1d38ab023f940ac83a.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'app/user.go')
-rw-r--r--app/user.go31
1 files changed, 19 insertions, 12 deletions
diff --git a/app/user.go b/app/user.go
index 2b160f9f5..1a444e123 100644
--- a/app/user.go
+++ b/app/user.go
@@ -34,7 +34,6 @@ const (
TOKEN_TYPE_PASSWORD_RECOVERY = "password_recovery"
TOKEN_TYPE_VERIFY_EMAIL = "verify_email"
PASSWORD_RECOVER_EXPIRY_TIME = 1000 * 60 * 60 // 1 hour
- VERIFY_EMAIL_EXPIRY_TIME = 1000 * 60 * 60 // 1 hour
IMAGE_PROFILE_PIXEL_DIMENSION = 128
)
@@ -202,9 +201,7 @@ func (a *App) CreateUser(user *model.User) (*model.User, *model.AppError) {
// This message goes to everyone, so the teamId, channelId and userId are irrelevant
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_NEW_USER, "", "", "", nil)
message.Add("user_id", ruser.Id)
- a.Go(func() {
- a.Publish(message)
- })
+ a.Publish(message)
return ruser, nil
}
@@ -508,6 +505,14 @@ func (a *App) GetUsersInChannel(channelId string, offset int, limit int) ([]*mod
}
}
+func (a *App) GetUsersInChannelByStatus(channelId string, offset int, limit int) ([]*model.User, *model.AppError) {
+ if result := <-a.Srv.Store.User().GetProfilesInChannelByStatus(channelId, offset, limit); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.([]*model.User), nil
+ }
+}
+
func (a *App) GetUsersInChannelMap(channelId string, offset int, limit int, asAdmin bool) (map[string]*model.User, *model.AppError) {
users, err := a.GetUsersInChannel(channelId, offset, limit)
if err != nil {
@@ -533,6 +538,15 @@ func (a *App) GetUsersInChannelPage(channelId string, page int, perPage int, asA
return a.sanitizeProfiles(users, asAdmin), nil
}
+func (a *App) GetUsersInChannelPageByStatus(channelId string, page int, perPage int, asAdmin bool) ([]*model.User, *model.AppError) {
+ users, err := a.GetUsersInChannelByStatus(channelId, page*perPage, perPage)
+ if err != nil {
+ return nil, err
+ }
+
+ return a.sanitizeProfiles(users, asAdmin), nil
+}
+
func (a *App) GetUsersNotInChannel(teamId string, channelId string, offset int, limit int) ([]*model.User, *model.AppError) {
if result := <-a.Srv.Store.User().GetProfilesNotInChannel(teamId, channelId, offset, limit); result.Err != nil {
return nil, result.Err
@@ -832,7 +846,6 @@ func (a *App) SetProfileImageFromFile(userId string, file multipart.File) *model
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_UPDATED, "", "", "", nil)
message.Add("user", user)
-
a.Publish(message)
}
@@ -901,10 +914,6 @@ func (a *App) UpdateActive(user *model.User, active bool) (*model.User, *model.A
}
}
- if extra := <-a.Srv.Store.Channel().ExtraUpdateByUser(user.Id, model.GetMillis()); extra.Err != nil {
- return nil, extra.Err
- }
-
ruser := result.Data.([2]*model.User)[0]
options := a.Config().GetSanitizeOptions()
options["passwordupdate"] = false
@@ -1002,9 +1011,7 @@ func (a *App) sendUpdatedUserEvent(user model.User, asAdmin bool) {
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_UPDATED, "", "", "", nil)
message.Add("user", user)
- a.Go(func() {
- a.Publish(message)
- })
+ a.Publish(message)
}
func (a *App) UpdateUser(user *model.User, sendNotifications bool) (*model.User, *model.AppError) {