diff options
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 |