diff options
author | enahum <nahumhbl@gmail.com> | 2016-09-06 15:48:43 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-06 15:48:43 -0300 |
commit | 35b816b92217237de922c928a6623b5ac426655a (patch) | |
tree | adf7e7a96bd4b50aae0b295f94f8501643e7fc38 /store | |
parent | 9a9ae3dcd1c248a5d9e6f986ea967fa8bbf06f19 (diff) | |
download | chat-35b816b92217237de922c928a6623b5ac426655a.tar.gz chat-35b816b92217237de922c928a6623b5ac426655a.tar.bz2 chat-35b816b92217237de922c928a6623b5ac426655a.zip |
PLT-3921 Fix System Console Recent Active Users (#3856)
* PLT-3921 System Console Recent Active Users
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_status_store.go | 22 | ||||
-rw-r--r-- | store/store.go | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/store/sql_status_store.go b/store/sql_status_store.go index 9f7441796..0915ced48 100644 --- a/store/sql_status_store.go +++ b/store/sql_status_store.go @@ -129,6 +129,28 @@ func (s SqlStatusStore) GetOnline() StoreChannel { return storeChannel } +func (s SqlStatusStore) GetAllFromTeam(teamId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var statuses []*model.Status + if _, err := s.GetReplica().Select(&statuses, + `SELECT s.* FROM Status AS s INNER JOIN + TeamMembers AS tm ON tm.TeamId=:TeamId AND s.UserId=tm.UserId`, map[string]interface{}{"TeamId": teamId}); err != nil { + result.Err = model.NewLocAppError("SqlStatusStore.GetAllFromTeam", "store.sql_status.get_team_statuses.app_error", nil, err.Error()) + } else { + result.Data = statuses + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlStatusStore) ResetAll() StoreChannel { storeChannel := make(StoreChannel) diff --git a/store/store.go b/store/store.go index d3b908106..cf08a6c64 100644 --- a/store/store.go +++ b/store/store.go @@ -275,6 +275,7 @@ type StatusStore interface { Get(userId string) StoreChannel GetOnlineAway() StoreChannel GetOnline() StoreChannel + GetAllFromTeam(teamId string) StoreChannel ResetAll() StoreChannel GetTotalActiveUsersCount() StoreChannel UpdateLastActivityAt(userId string, lastActivityAt int64) StoreChannel |