Commit 4f918e37 by dependabot[bot] Committed by GitHub

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>
parent dde11215
...@@ -100,5 +100,5 @@ require ( ...@@ -100,5 +100,5 @@ require (
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
gotest.tools v2.2.0+incompatible gotest.tools v2.2.0+incompatible
xorm.io/core v0.7.3 xorm.io/core v0.7.3
xorm.io/xorm v0.8.1 xorm.io/xorm v0.8.2
) )
...@@ -2095,5 +2095,5 @@ xorm.io/builder v0.3.6/go.mod h1:LEFAPISnRzG+zxaxj2vPicRwz67BdhFreKg8yv8/TgU= ...@@ -2095,5 +2095,5 @@ xorm.io/builder v0.3.6/go.mod h1:LEFAPISnRzG+zxaxj2vPicRwz67BdhFreKg8yv8/TgU=
xorm.io/core v0.7.2/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM= xorm.io/core v0.7.2/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM=
xorm.io/core v0.7.3 h1:W8ws1PlrnkS1CZU1YWaYLMQcQilwAmQXU0BJDJon+H0= xorm.io/core v0.7.3 h1:W8ws1PlrnkS1CZU1YWaYLMQcQilwAmQXU0BJDJon+H0=
xorm.io/core v0.7.3/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM= xorm.io/core v0.7.3/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM=
xorm.io/xorm v0.8.1 h1:4f2KXuQxVdaX3RdI3Fw81NzMiSpZeyCZt8m3sEVeIkQ= xorm.io/xorm v0.8.2 h1:nbg1AyWn7iLrwp0Dqg8IrYOBkBYYJ85ry9bvZLVl4Ok=
xorm.io/xorm v0.8.1/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY= xorm.io/xorm v0.8.2/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY=
...@@ -106,7 +106,10 @@ func GetDashboardSnapshot(query *models.GetDashboardSnapshotQuery) error { ...@@ -106,7 +106,10 @@ func GetDashboardSnapshot(query *models.GetDashboardSnapshotQuery) error {
func SearchDashboardSnapshots(query *models.GetDashboardSnapshotsQuery) error { func SearchDashboardSnapshots(query *models.GetDashboardSnapshotsQuery) error {
var snapshots = make(models.DashboardSnapshotsList, 0) 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") sess.Table("dashboard_snapshot")
if query.Name != "" { if query.Name != "" {
......
...@@ -39,7 +39,10 @@ func SearchOrgs(query *models.SearchOrgsQuery) error { ...@@ -39,7 +39,10 @@ func SearchOrgs(query *models.SearchOrgsQuery) error {
sess.In("id", query.Ids) 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") sess.Cols("id", "name")
err := sess.Find(&query.Result) err := sess.Find(&query.Result)
return err return err
......
...@@ -614,8 +614,11 @@ func SearchUsers(query *models.SearchUsersQuery) error { ...@@ -614,8 +614,11 @@ func SearchUsers(query *models.SearchUsersQuery) error {
sess.Where(strings.Join(whereConditions, " AND "), whereParams...) sess.Where(strings.Join(whereConditions, " AND "), whereParams...)
} }
offset := query.Limit * (query.Page - 1) if query.Limit > 0 {
sess.Limit(query.Limit, offset) 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.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") sess.Asc("u.login", "u.email")
if err := sess.Find(&query.Result.Users); err != nil { if err := sess.Find(&query.Result.Users); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment