summaryrefslogtreecommitdiffstats
path: root/store/sql_status_store.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 /store/sql_status_store.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 'store/sql_status_store.go')
-rw-r--r--store/sql_status_store.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/store/sql_status_store.go b/store/sql_status_store.go
index 235d12fa8..bb3c7c364 100644
--- a/store/sql_status_store.go
+++ b/store/sql_status_store.go
@@ -98,7 +98,27 @@ func (s SqlStatusStore) GetOnlineAway() StoreChannel {
var statuses []*model.Status
if _, err := s.GetReplica().Select(&statuses, "SELECT * FROM Status WHERE Status = :Online OR Status = :Away", map[string]interface{}{"Online": model.STATUS_ONLINE, "Away": model.STATUS_AWAY}); err != nil {
- result.Err = model.NewLocAppError("SqlStatusStore.GetOnline", "store.sql_status.get_online_away.app_error", nil, err.Error())
+ result.Err = model.NewLocAppError("SqlStatusStore.GetOnlineAway", "store.sql_status.get_online_away.app_error", nil, err.Error())
+ } else {
+ result.Data = statuses
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
+func (s SqlStatusStore) GetOnline() StoreChannel {
+ storeChannel := make(StoreChannel)
+
+ go func() {
+ result := StoreResult{}
+
+ var statuses []*model.Status
+ if _, err := s.GetReplica().Select(&statuses, "SELECT * FROM Status WHERE Status = :Online", map[string]interface{}{"Online": model.STATUS_ONLINE}); err != nil {
+ result.Err = model.NewLocAppError("SqlStatusStore.GetOnline", "store.sql_status.get_online.app_error", nil, err.Error())
} else {
result.Data = statuses
}