aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-07-26 15:40:23 +0800
committerGitHub <noreply@github.com>2023-07-26 07:40:23 +0000
commitbc73e6a85c04d4f63b77dea9f1deac5b21d3678c (patch)
tree1cf4f15db60d065e5660b7665dcd7cacae9b868b /models
parenta8445e93204ab91065c45223bf5d4f7e06578549 (diff)
downloadgitea-bc73e6a85c04d4f63b77dea9f1deac5b21d3678c.tar.gz
gitea-bc73e6a85c04d4f63b77dea9f1deac5b21d3678c.zip
Update xorm version (#26128) (#26150)
backport #26128 to fix some serious bug. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'models')
-rw-r--r--models/project/project.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/models/project/project.go b/models/project/project.go
index 6fa2adf604..17348a9443 100644
--- a/models/project/project.go
+++ b/models/project/project.go
@@ -241,7 +241,10 @@ func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy {
// FindProjects returns a list of all projects that have been created in the repository
func FindProjects(ctx context.Context, opts SearchOptions) ([]*Project, int64, error) {
- e := db.GetEngine(ctx).Where(opts.toConds()).OrderBy(opts.OrderBy.String())
+ e := db.GetEngine(ctx).Where(opts.toConds())
+ if opts.OrderBy.String() != "" {
+ e = e.OrderBy(opts.OrderBy.String())
+ }
projects := make([]*Project, 0, setting.UI.IssuePagingNum)
if opts.Page > 0 {