[MM-16572] Migrate "User.AnalyticsGetSystemAdminCount" to Sync by default (#11484)

Этот коммит содержится в:
SezalAgrawal
2019-07-02 14:51:38 +05:30
коммит произвёл Hanzei
родитель b664291f21
Коммит f881b00650
5 изменённых файлов: 28 добавлений и 23 удалений

Просмотреть файл

@@ -1427,14 +1427,12 @@ func (us SqlUserStore) AnalyticsGetInactiveUsersCount() (int64, *model.AppError)
return count, nil
}
func (us SqlUserStore) AnalyticsGetSystemAdminCount() store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
if count, err := us.GetReplica().SelectInt("SELECT count(*) FROM Users WHERE Roles LIKE :Roles and DeleteAt = 0", map[string]interface{}{"Roles": "%system_admin%"}); err != nil {
result.Err = model.NewAppError("SqlUserStore.AnalyticsGetSystemAdminCount", "store.sql_user.analytics_get_system_admin_count.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
result.Data = count
}
})
func (us SqlUserStore) AnalyticsGetSystemAdminCount() (int64, *model.AppError) {
count, err := us.GetReplica().SelectInt("SELECT count(*) FROM Users WHERE Roles LIKE :Roles and DeleteAt = 0", map[string]interface{}{"Roles": "%system_admin%"})
if err != nil {
return int64(0), model.NewAppError("SqlUserStore.AnalyticsGetSystemAdminCount", "store.sql_user.analytics_get_system_admin_count.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return count, nil
}
func (us SqlUserStore) GetProfilesNotInTeam(teamId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) store.StoreChannel {