chore: fix form string abuse (#38106)

This commit is contained in:
wxiaoguang
2026-06-14 18:26:22 +00:00
committed by GitHub
parent 3417bc8979
commit 47d48eb208
8 changed files with 25 additions and 47 deletions
+3 -6
View File
@@ -38,17 +38,14 @@ func Organizations(ctx *context.Context) {
"alphabetically",
"reversealphabetically",
)
sortOrder := ctx.FormString("sort")
if sortOrder == "" {
sortOrder = util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
ctx.SetFormString("sort", sortOrder)
}
sortOrderDefault := util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
sortOrder := ctx.FormString("sort", sortOrderDefault)
RenderUserSearch(ctx, user_model.SearchUserOptions{
Actor: ctx.Doer,
Types: []user_model.UserType{user_model.UserTypeOrganization},
ListOptions: db.ListOptions{PageSize: setting.UI.ExplorePagingNum},
Visible: visibleTypes,
OrderBy: db.SearchOrderBy(sortOrder),
SupportedSortOrders: supportedSortOrders,
}, tplExploreUsers)