Reset status to away after web conn disconnect if necessary (#8988)

Этот коммит содержится в:
Joram Wilander
2018-06-27 17:19:06 -04:00
коммит произвёл Christopher Speller
родитель 437f9f5b64
Коммит 2114e96f00
4 изменённых файлов: 68 добавлений и 9 удалений

Просмотреть файл

@@ -161,6 +161,22 @@ func (a *App) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.Ap
return statusMap, nil
}
// SetStatusLastActivityAt sets the last activity at for a user on the local app server and updates
// status to away if needed. Used by the WS to set status to away if an 'online' device disconnects
// while an 'away' device is still connected
func (a *App) SetStatusLastActivityAt(userId string, activityAt int64) {
var status *model.Status
var err *model.AppError
if status, err = a.GetStatus(userId); err != nil {
return
}
status.LastActivityAt = activityAt
a.AddStatusCacheSkipClusterSend(status)
a.SetStatusAwayIfNeeded(userId, false)
}
func (a *App) SetStatusOnline(userId string, sessionId string, manual bool) {
if !*a.Config().ServiceSettings.EnableUserStatuses {
return