summaryrefslogtreecommitdiffstats
path: root/app/status.go
diff options
context:
space:
mode:
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