mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Migrate User.InferSystemInstallDate to sync by default (#11505)
* Migrate User.InferSystemInstallDate to sync by default * Change var name
This commit is contained in:
committed by
Miguel de la Cruz
parent
7663c5b00e
commit
e908165fe3
@@ -1488,15 +1488,13 @@ func (us SqlUserStore) ClearAllCustomRoleAssignments() *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (us SqlUserStore) InferSystemInstallDate() store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
createAt, err := us.GetReplica().SelectInt("SELECT CreateAt FROM Users WHERE CreateAt IS NOT NULL ORDER BY CreateAt ASC LIMIT 1")
|
||||
if err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.GetSystemInstallDate", "store.sql_user.get_system_install_date.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
result.Data = createAt
|
||||
})
|
||||
func (us SqlUserStore) InferSystemInstallDate() (int64, *model.AppError) {
|
||||
createAt, err := us.GetReplica().SelectInt("SELECT CreateAt FROM Users WHERE CreateAt IS NOT NULL ORDER BY CreateAt ASC LIMIT 1")
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlUserStore.GetSystemInstallDate", "store.sql_user.get_system_install_date.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return createAt, nil
|
||||
}
|
||||
|
||||
func (us SqlUserStore) GetUsersBatchForIndexing(startTime, endTime int64, limit int) ([]*model.UserForIndexing, *model.AppError) {
|
||||
|
||||
@@ -301,7 +301,7 @@ type UserStore interface {
|
||||
GetProfilesNotInTeam(teamId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
|
||||
GetEtagForProfilesNotInTeam(teamId string) StoreChannel
|
||||
ClearAllCustomRoleAssignments() *model.AppError
|
||||
InferSystemInstallDate() StoreChannel
|
||||
InferSystemInstallDate() (int64, *model.AppError)
|
||||
GetAllAfter(limit int, afterId string) ([]*model.User, *model.AppError)
|
||||
GetUsersBatchForIndexing(startTime, endTime int64, limit int) ([]*model.UserForIndexing, *model.AppError)
|
||||
Count(options model.UserCountOptions) (int64, *model.AppError)
|
||||
|
||||
@@ -820,19 +820,26 @@ func (_m *UserStore) GetUsersBatchForIndexing(startTime int64, endTime int64, li
|
||||
}
|
||||
|
||||
// InferSystemInstallDate provides a mock function with given fields:
|
||||
func (_m *UserStore) InferSystemInstallDate() store.StoreChannel {
|
||||
func (_m *UserStore) InferSystemInstallDate() (int64, *model.AppError) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 store.StoreChannel
|
||||
if rf, ok := ret.Get(0).(func() store.StoreChannel); ok {
|
||||
var r0 int64
|
||||
if rf, ok := ret.Get(0).(func() int64); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(store.StoreChannel)
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
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
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// InvalidatProfileCacheForUser provides a mock function with given fields: userId
|
||||
|
||||
Reference in New Issue
Block a user