Chore(deps): Bump xorm.io/xorm from 0.8.1 to 0.8.2 (#30773)

* Chore(deps): Bump xorm.io/xorm from 0.8.1 to 0.8.2

Bumps xorm.io/xorm from 0.8.1 to 0.8.2.

Signed-off-by: dependabot[bot] <support@github.com>

* Fix limit for snapshots

* Fix limit for org and users

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
dependabot[bot]
2021-02-15 09:59:39 +01:00
committed by GitHub
co-authored by Marcus Efraimsson
parent dde11215e9
commit 4f918e37f4
5 changed files with 16 additions and 7 deletions
+4 -1
View File
@@ -106,7 +106,10 @@ func GetDashboardSnapshot(query *models.GetDashboardSnapshotQuery) error {
func SearchDashboardSnapshots(query *models.GetDashboardSnapshotsQuery) error {
var snapshots = make(models.DashboardSnapshotsList, 0)
sess := x.Limit(query.Limit)
sess := x.NewSession()
if query.Limit > 0 {
sess.Limit(query.Limit)
}
sess.Table("dashboard_snapshot")
if query.Name != "" {
+4 -1
View File
@@ -39,7 +39,10 @@ func SearchOrgs(query *models.SearchOrgsQuery) error {
sess.In("id", query.Ids)
}
sess.Limit(query.Limit, query.Limit*query.Page)
if query.Limit > 0 {
sess.Limit(query.Limit, query.Limit*query.Page)
}
sess.Cols("id", "name")
err := sess.Find(&query.Result)
return err
+5 -2
View File
@@ -614,8 +614,11 @@ func SearchUsers(query *models.SearchUsersQuery) error {
sess.Where(strings.Join(whereConditions, " AND "), whereParams...)
}
offset := query.Limit * (query.Page - 1)
sess.Limit(query.Limit, offset)
if query.Limit > 0 {
offset := query.Limit * (query.Page - 1)
sess.Limit(query.Limit, offset)
}
sess.Cols("u.id", "u.email", "u.name", "u.login", "u.is_admin", "u.is_disabled", "u.last_seen_at", "user_auth.auth_module")
sess.Asc("u.login", "u.email")
if err := sess.Find(&query.Result.Users); err != nil {