summaryrefslogtreecommitdiffstats
path: root/api/status.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-07-21 10:00:09 -0400
committerGitHub <noreply@github.com>2016-07-21 10:00:09 -0400
commitbfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3 (patch)
tree6a51f8d4d144a181192499f5fd60ef82700e9abb /api/status.go
parentf0e9ec2dd127ffe34472c617f978173a8bf60b7c (diff)
downloadchat-bfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3.tar.gz
chat-bfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3.tar.bz2
chat-bfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3.zip
PLT-2408 Adds here mention for online users (#3619)
* Added @here mention that notifies online users * Fixed existing race condition that would sometime cause clients to miss mention count changes * Added missing localization strings * Prevent @here from mentioning the user who posted it
Diffstat (limited to 'api/status.go')
-rw-r--r--api/status.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/api/status.go b/api/status.go
index 88f024f4e..2a5a73c4a 100644
--- a/api/status.go
+++ b/api/status.go
@@ -55,14 +55,12 @@ func GetAllStatuses() (map[string]interface{}, *model.AppError) {
func SetStatusOnline(userId string, sessionId string) {
broadcast := false
- saveStatus := false
var status *model.Status
var err *model.AppError
if status, err = GetStatus(userId); err != nil {
status = &model.Status{userId, model.STATUS_ONLINE, model.GetMillis()}
broadcast = true
- saveStatus = true
} else {
if status.Status != model.STATUS_ONLINE {
broadcast = true
@@ -76,7 +74,7 @@ func SetStatusOnline(userId string, sessionId string) {
achan := Srv.Store.Session().UpdateLastActivityAt(sessionId, model.GetMillis())
var schan store.StoreChannel
- if saveStatus {
+ if broadcast {
schan = Srv.Store.Status().SaveOrUpdate(status)
} else {
schan = Srv.Store.Status().UpdateLastActivityAt(status.UserId, status.LastActivityAt)