File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 99 "code.gitea.io/gitea/modules/container"
1010 "code.gitea.io/gitea/modules/setting"
1111 "code.gitea.io/gitea/modules/structs"
12+ "code.gitea.io/gitea/modules/util"
1213 "code.gitea.io/gitea/services/context"
1314)
1415
@@ -33,7 +34,7 @@ func Organizations(ctx *context.Context) {
3334 )
3435 sortOrder := ctx .FormString ("sort" )
3536 if sortOrder == "" {
36- sortOrder = "newest"
37+ sortOrder = util . Iif ( supportedSortOrders . Contains ( setting . UI . ExploreDefaultSort ), setting . UI . ExploreDefaultSort , "newest" )
3738 ctx .SetFormString ("sort" , sortOrder )
3839 }
3940
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
1616 "code.gitea.io/gitea/modules/setting"
1717 "code.gitea.io/gitea/modules/sitemap"
1818 "code.gitea.io/gitea/modules/structs"
19+ "code.gitea.io/gitea/modules/util"
1920 "code.gitea.io/gitea/services/context"
2021)
2122
@@ -147,7 +148,7 @@ func Users(ctx *context.Context) {
147148 )
148149 sortOrder := ctx .FormString ("sort" )
149150 if sortOrder == "" {
150- sortOrder = "newest"
151+ sortOrder = util . Iif ( supportedSortOrders . Contains ( setting . UI . ExploreDefaultSort ), setting . UI . ExploreDefaultSort , "newest" )
151152 ctx .SetFormString ("sort" , sortOrder )
152153 }
153154
Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ func RegenerateScratchTwoFactor(ctx *context.Context) {
3333 if auth .IsErrTwoFactorNotEnrolled (err ) {
3434 ctx .Flash .Error (ctx .Tr ("settings.twofa_not_enrolled" ))
3535 ctx .Redirect (setting .AppSubURL + "/user/settings/security" )
36+ } else {
37+ ctx .ServerError ("SettingsTwoFactor: Failed to GetTwoFactorByUID" , err )
3638 }
37- ctx .ServerError ("SettingsTwoFactor: Failed to GetTwoFactorByUID" , err )
3839 return
3940 }
4041
@@ -63,8 +64,9 @@ func DisableTwoFactor(ctx *context.Context) {
6364 if auth .IsErrTwoFactorNotEnrolled (err ) {
6465 ctx .Flash .Error (ctx .Tr ("settings.twofa_not_enrolled" ))
6566 ctx .Redirect (setting .AppSubURL + "/user/settings/security" )
67+ } else {
68+ ctx .ServerError ("SettingsTwoFactor: Failed to GetTwoFactorByUID" , err )
6669 }
67- ctx .ServerError ("SettingsTwoFactor: Failed to GetTwoFactorByUID" , err )
6870 return
6971 }
7072
@@ -73,8 +75,9 @@ func DisableTwoFactor(ctx *context.Context) {
7375 // There is a potential DB race here - we must have been disabled by another request in the intervening period
7476 ctx .Flash .Success (ctx .Tr ("settings.twofa_disabled" ))
7577 ctx .Redirect (setting .AppSubURL + "/user/settings/security" )
78+ } else {
79+ ctx .ServerError ("SettingsTwoFactor: Failed to DeleteTwoFactorByID" , err )
7680 }
77- ctx .ServerError ("SettingsTwoFactor: Failed to DeleteTwoFactorByID" , err )
7881 return
7982 }
8083
You can’t perform that action at this time.
0 commit comments