From 0ae68865138458f2f8fd36bbbba07728c88609d7 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 10 May 2017 09:48:50 -0400 Subject: Detach session activity update from statuses (#6379) --- app/status.go | 5 ----- 1 file changed, 5 deletions(-) (limited to 'app/status.go') diff --git a/app/status.go b/app/status.go index dd57b82b2..f0a26e6eb 100644 --- a/app/status.go +++ b/app/status.go @@ -195,7 +195,6 @@ func SetStatusOnline(userId string, sessionId string, manual bool) { // Only update the database if the status has changed, the status has been manually set, // or enough time has passed since the previous action if status.Status != oldStatus || status.Manual != oldManual || status.LastActivityAt-oldTime > model.STATUS_MIN_UPDATE_TIME { - achan := Srv.Store.Session().UpdateLastActivityAt(sessionId, status.LastActivityAt) var schan store.StoreChannel if broadcast { @@ -204,10 +203,6 @@ func SetStatusOnline(userId string, sessionId string, manual bool) { schan = Srv.Store.Status().UpdateLastActivityAt(status.UserId, status.LastActivityAt) } - if result := <-achan; result.Err != nil { - l4g.Error(utils.T("api.status.last_activity.error"), userId, sessionId, result.Err) - } - if result := <-schan; result.Err != nil { l4g.Error(utils.T("api.status.save_status.error"), userId, result.Err) } -- cgit v1.2.3-1-g7c22 From be7c53ec7fffaa1751a162f4a34760f94e941bc6 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 11 May 2017 08:10:59 -0400 Subject: Send status change event if status changes on channel view (#6389) --- app/status.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app/status.go') diff --git a/app/status.go b/app/status.go index f0a26e6eb..868e57563 100644 --- a/app/status.go +++ b/app/status.go @@ -209,13 +209,17 @@ func SetStatusOnline(userId string, sessionId string, manual bool) { } if broadcast { - event := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_STATUS_CHANGE, "", "", status.UserId, nil) - event.Add("status", model.STATUS_ONLINE) - event.Add("user_id", status.UserId) - go Publish(event) + BroadcastStatus(status) } } +func BroadcastStatus(status *model.Status) { + event := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_STATUS_CHANGE, "", "", status.UserId, nil) + event.Add("status", status.Status) + event.Add("user_id", status.UserId) + go Publish(event) +} + func SetStatusOffline(userId string, manual bool) { if !*utils.Cfg.ServiceSettings.EnableUserStatuses { return -- cgit v1.2.3-1-g7c22