]> source.dussan.org Git - gitea.git/commitdiff
Respect UI.ExploreDefaultSort setting again (#32357)
author6543 <6543@obermui.de>
Wed, 30 Oct 2024 12:33:25 +0000 (13:33 +0100)
committerGitHub <noreply@github.com>
Wed, 30 Oct 2024 12:33:25 +0000 (12:33 +0000)
fix regression of https://github.com/go-gitea/gitea/pull/29430

---
*Sponsored by Kithara Software GmbH*

routers/web/explore/org.go
routers/web/explore/user.go

index 7178630b64e95f4f9e1f6427607e56d010ac625c..7bb71acfd78e04292f2fff743c7af7335aa4371c 100644 (file)
@@ -9,6 +9,7 @@ import (
        "code.gitea.io/gitea/modules/container"
        "code.gitea.io/gitea/modules/setting"
        "code.gitea.io/gitea/modules/structs"
+       "code.gitea.io/gitea/modules/util"
        "code.gitea.io/gitea/services/context"
 )
 
@@ -39,7 +40,7 @@ func Organizations(ctx *context.Context) {
        )
        sortOrder := ctx.FormString("sort")
        if sortOrder == "" {
-               sortOrder = "newest"
+               sortOrder = util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
                ctx.SetFormString("sort", sortOrder)
        }
 
index 5f6b8fcee61037b8c3207a1336fad5c2acc7bd57..c009982d420ce7926c1a4bad91f01e867686d8b3 100644 (file)
@@ -16,6 +16,7 @@ import (
        "code.gitea.io/gitea/modules/setting"
        "code.gitea.io/gitea/modules/sitemap"
        "code.gitea.io/gitea/modules/structs"
+       "code.gitea.io/gitea/modules/util"
        "code.gitea.io/gitea/services/context"
 )
 
@@ -149,7 +150,7 @@ func Users(ctx *context.Context) {
        )
        sortOrder := ctx.FormString("sort")
        if sortOrder == "" {
-               sortOrder = "newest"
+               sortOrder = util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
                ctx.SetFormString("sort", sortOrder)
        }