summaryrefslogtreecommitdiffstats
path: root/app/status.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2017-05-12 08:00:28 -0400
committerJoramWilander <jwawilander@gmail.com>2017-05-12 08:00:28 -0400
commit9d109b070037951fcd0832b785eba8a3db9a157c (patch)
tree5d109da2e9e088f16eff0ad1421876a3d3da412e /app/status.go
parentb1c39204a63a87d2cbc57f66cf9db50c938b2ee5 (diff)
parenta21a06afd9907e9911dcb166d902cba9f405c7cb (diff)
downloadchat-9d109b070037951fcd0832b785eba8a3db9a157c.tar.gz
chat-9d109b070037951fcd0832b785eba8a3db9a157c.tar.bz2
chat-9d109b070037951fcd0832b785eba8a3db9a157c.zip
Merge branch 'release-3.9' into merge-3.9
Diffstat (limited to 'app/status.go')
-rw-r--r--app/status.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/status.go b/app/status.go
index dd57b82b2..868e57563 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,23 +203,23 @@ 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)
}
}
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