From 4ebf9746905c845ee3874f87478d7450391680d8 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 2 Mar 2018 10:49:18 -0600 Subject: remove `go Publish(...)` idiom (#8373) --- app/user.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'app/user.go') diff --git a/app/user.go b/app/user.go index f915f35cb..5790be21e 100644 --- a/app/user.go +++ b/app/user.go @@ -202,9 +202,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 } @@ -832,7 +830,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) } @@ -1002,9 +999,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) { -- cgit v1.2.3-1-g7c22 From e8943936c51450540a4f2e8e7a2f3a2af90d14db Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 7 Mar 2018 12:36:40 -0600 Subject: general cleanup (#8387) --- app/user.go | 1 - 1 file changed, 1 deletion(-) (limited to 'app/user.go') diff --git a/app/user.go b/app/user.go index 5790be21e..c303cbc68 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 ) -- cgit v1.2.3-1-g7c22 From 302dae5bb982aad14324a4df61a018557f3dd24e Mon Sep 17 00:00:00 2001 From: Stephen Kiers Date: Fri, 9 Mar 2018 05:48:30 -0700 Subject: MM-9274- Sort Users in Channel by status (#8181) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * sort by lastActivity * added status ordering to Users * sort offline before dnd * remove data not needed * added seperate call for when order=‘status’ is on GetUser request * remove PrintLn * styling fix * remove mistake * mistake 2 * better comment * explicit if statemnt * writing tests * removed manually added mocks * generated mock * ICU-668 Added unit tests * style fix * sort by lastActivity * added status ordering to Users * sort offline before dnd * remove data not needed * added seperate call for when order=‘status’ is on GetUser request * remove PrintLn * styling fix * remove mistake * mistake 2 * better comment * explicit if statemnt * writing tests * removed manually added mocks * generated mock * ICU-668 Added unit tests * style fix * reverse dnd and offline * Fixed app.SaveStatusAndBroadcast * Fixed incorrect merge * Fixing incorrect merge again --- app/user.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/user.go') diff --git a/app/user.go b/app/user.go index c303cbc68..dbce296d2 100644 --- a/app/user.go +++ b/app/user.go @@ -505,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 { @@ -530,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 -- cgit v1.2.3-1-g7c22 From 8ad99b4b1fbc901a69886d9a12ac016d8396b32f Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 9 Mar 2018 08:06:31 -0500 Subject: Remove query to update channel extra_update_at field on user activation/deactivation (#8415) --- app/user.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'app/user.go') diff --git a/app/user.go b/app/user.go index dbce296d2..7a6dc0b49 100644 --- a/app/user.go +++ b/app/user.go @@ -914,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 -- cgit v1.2.3-1-g7c22