@@ -354,18 +354,22 @@ func reqToken() func(ctx *context.APIContext) {
354354 }
355355}
356356
357- func reqExploreSignInAndUsersExploreEnabled () func (ctx * context.APIContext ) {
357+ func reqExploreSignIn () func (ctx * context.APIContext ) {
358358 return func (ctx * context.APIContext ) {
359- if setting .Service .Explore .DisableUsersPage {
360- ctx .NotFound ()
361- return
362- }
363359 if setting .Service .Explore .RequireSigninView && ! ctx .IsSigned {
364360 ctx .Error (http .StatusUnauthorized , "reqExploreSignIn" , "you must be signed in to search for users" )
365361 }
366362 }
367363}
368364
365+ func reqUsersExploreEnabled () func (ctx * context.APIContext ) {
366+ return func (ctx * context.APIContext ) {
367+ if setting .Service .Explore .DisableUsersPage {
368+ ctx .NotFound ()
369+ }
370+ }
371+ }
372+
369373func reqBasicOrRevProxyAuth () func (ctx * context.APIContext ) {
370374 return func (ctx * context.APIContext ) {
371375 if ctx .IsSigned && setting .Service .EnableReverseProxyAuthAPI && ctx .Data ["AuthedMethod" ].(string ) == auth .ReverseProxyMethodName {
@@ -959,16 +963,16 @@ func Routes() *web.Router {
959963
960964 // Users (requires user scope)
961965 m .Group ("/users" , func () {
962- m .Get ("/search" , reqExploreSignInAndUsersExploreEnabled (), user .Search )
966+ m .Get ("/search" , reqExploreSignIn (), reqUsersExploreEnabled (), user .Search )
963967
964968 m .Group ("/{username}" , func () {
965- m .Get ("" , reqExploreSignInAndUsersExploreEnabled (), user .GetInfo )
969+ m .Get ("" , reqExploreSignIn (), user .GetInfo )
966970
967971 if setting .Service .EnableUserHeatmap {
968972 m .Get ("/heatmap" , user .GetUserHeatmapData )
969973 }
970974
971- m .Get ("/repos" , tokenRequiresScopes (auth_model .AccessTokenScopeCategoryRepository ), reqExploreSignInAndUsersExploreEnabled (), user .ListUserRepos )
975+ m .Get ("/repos" , tokenRequiresScopes (auth_model .AccessTokenScopeCategoryRepository ), reqExploreSignIn (), user .ListUserRepos )
972976 m .Group ("/tokens" , func () {
973977 m .Combo ("" ).Get (user .ListAccessTokens ).
974978 Post (bind (api.CreateAccessTokenOption {}), reqToken (), user .CreateAccessToken )
0 commit comments