summaryrefslogtreecommitdiffstats
path: root/app/status.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-06-27 17:19:06 -0400
committerChristopher Speller <crspeller@gmail.com>2018-06-27 14:19:06 -0700
commit2114e96f0045376f41d5c318f7cf45b6b50141dc (patch)
treedfa72c7110ccd08bf5a6f49633b1dc6aa441eee6 /app/status.go
parent437f9f5b64ddb4e1f84e6c4e993120d074001777 (diff)
downloadchat-2114e96f0045376f41d5c318f7cf45b6b50141dc.tar.gz
chat-2114e96f0045376f41d5c318f7cf45b6b50141dc.tar.bz2
chat-2114e96f0045376f41d5c318f7cf45b6b50141dc.zip
Reset status to away after web conn disconnect if necessary (#8988)
Diffstat (limited to 'app/status.go')
-rw-r--r--app/status.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/status.go b/app/status.go
index e2367a396..460cbbbd0 100644
--- a/app/status.go
+++ b/app/status.go
@@ -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