Respect UI.ExploreDefaultSort setting again (#32357) (#32385)

Backport #32357

fix regression of https://github.com/go-gitea/gitea/pull/29430

---
*Sponsored by Kithara Software GmbH*
This commit is contained in:
6543 2024-10-31 06:49:09 +01:00 committed by GitHub
parent bf53ab26fa
commit 9d62d7a443
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/context" "code.gitea.io/gitea/services/context"
) )
@ -33,7 +34,7 @@ func Organizations(ctx *context.Context) {
) )
sortOrder := ctx.FormString("sort") sortOrder := ctx.FormString("sort")
if sortOrder == "" { if sortOrder == "" {
sortOrder = "newest" sortOrder = util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
ctx.SetFormString("sort", sortOrder) ctx.SetFormString("sort", sortOrder)
} }

View File

@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/sitemap" "code.gitea.io/gitea/modules/sitemap"
"code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/context" "code.gitea.io/gitea/services/context"
) )
@ -147,7 +148,7 @@ func Users(ctx *context.Context) {
) )
sortOrder := ctx.FormString("sort") sortOrder := ctx.FormString("sort")
if sortOrder == "" { if sortOrder == "" {
sortOrder = "newest" sortOrder = util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
ctx.SetFormString("sort", sortOrder) ctx.SetFormString("sort", sortOrder)
} }