Migrates Status.GetOnline to sync by default (#11351)
* Status.GetOnline to sync by default * Removed else sentence
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
162a2a9903
Коммит
0199cef145
@@ -111,15 +111,12 @@ func (s SqlStatusStore) GetOnlineAway() store.StoreChannel {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SqlStatusStore) GetOnline() store.StoreChannel {
|
func (s SqlStatusStore) GetOnline() ([]*model.Status, *model.AppError) {
|
||||||
return store.Do(func(result *store.StoreResult) {
|
var statuses []*model.Status
|
||||||
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 {
|
||||||
if _, err := s.GetReplica().Select(&statuses, "SELECT * FROM Status WHERE Status = :Online", map[string]interface{}{"Online": model.STATUS_ONLINE}); err != nil {
|
return nil, model.NewAppError("SqlStatusStore.GetOnline", "store.sql_status.get_online.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
result.Err = model.NewAppError("SqlStatusStore.GetOnline", "store.sql_status.get_online.app_error", nil, err.Error(), http.StatusInternalServerError)
|
}
|
||||||
} else {
|
return statuses, nil
|
||||||
result.Data = statuses
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SqlStatusStore) GetAllFromTeam(teamId string) store.StoreChannel {
|
func (s SqlStatusStore) GetAllFromTeam(teamId string) store.StoreChannel {
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ type StatusStore interface {
|
|||||||
Get(userId string) StoreChannel
|
Get(userId string) StoreChannel
|
||||||
GetByIds(userIds []string) StoreChannel
|
GetByIds(userIds []string) StoreChannel
|
||||||
GetOnlineAway() StoreChannel
|
GetOnlineAway() StoreChannel
|
||||||
GetOnline() StoreChannel
|
GetOnline() ([]*model.Status, *model.AppError)
|
||||||
GetAllFromTeam(teamId string) StoreChannel
|
GetAllFromTeam(teamId string) StoreChannel
|
||||||
ResetAll() StoreChannel
|
ResetAll() StoreChannel
|
||||||
GetTotalActiveUsersCount() StoreChannel
|
GetTotalActiveUsersCount() StoreChannel
|
||||||
|
|||||||
@@ -62,19 +62,28 @@ func (_m *StatusStore) GetByIds(userIds []string) store.StoreChannel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetOnline provides a mock function with given fields:
|
// GetOnline provides a mock function with given fields:
|
||||||
func (_m *StatusStore) GetOnline() store.StoreChannel {
|
func (_m *StatusStore) GetOnline() ([]*model.Status, *model.AppError) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
||||||
var r0 store.StoreChannel
|
var r0 []*model.Status
|
||||||
if rf, ok := ret.Get(0).(func() store.StoreChannel); ok {
|
if rf, ok := ret.Get(0).(func() []*model.Status); ok {
|
||||||
r0 = rf()
|
r0 = rf()
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
if ret.Get(0) != nil {
|
||||||
r0 = ret.Get(0).(store.StoreChannel)
|
r0 = ret.Get(0).([]*model.Status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
var r1 *model.AppError
|
||||||
|
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
|
||||||
|
r1 = rf()
|
||||||
|
} else {
|
||||||
|
if ret.Get(1) != nil {
|
||||||
|
r1 = ret.Get(1).(*model.AppError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOnlineAway provides a mock function with given fields:
|
// GetOnlineAway provides a mock function with given fields:
|
||||||
|
|||||||
@@ -58,10 +58,9 @@ func testStatusStore(t *testing.T, ss store.Store) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if result := <-ss.Status().GetOnline(); result.Err != nil {
|
if statuses, err := ss.Status().GetOnline(); err != nil {
|
||||||
t.Fatal(result.Err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
statuses := result.Data.([]*model.Status)
|
|
||||||
for _, status := range statuses {
|
for _, status := range statuses {
|
||||||
if status.Status != model.STATUS_ONLINE {
|
if status.Status != model.STATUS_ONLINE {
|
||||||
t.Fatal("should not have returned offline statuses")
|
t.Fatal("should not have returned offline statuses")
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user