From 1f8f9c3826643b8c3a0c3da1dc15090af736f5a6 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Wed, 15 Jun 2022 18:05:32 +0300 Subject: [PATCH] Remove tab/TabName usage where it's not needed (#19973) `tab` query argument and `TabName` in context is used only in profile so remove it from all other places where it's not used anymore. --- integrations/links_test.go | 12 ++++++------ modules/context/pagination.go | 1 - routers/web/user/profile.go | 1 + templates/admin/repo/search.tmpl | 8 ++++---- templates/explore/code.tmpl | 1 - templates/explore/repo_list.tmpl | 2 +- templates/explore/repo_search.tmpl | 21 ++++++++++----------- templates/explore/search.tmpl | 13 ++++++------- 8 files changed, 28 insertions(+), 31 deletions(-) diff --git a/integrations/links_test.go b/integrations/links_test.go index bc87ffad83..d0cf978f65 100644 --- a/integrations/links_test.go +++ b/integrations/links_test.go @@ -22,11 +22,11 @@ func TestLinksNoLogin(t *testing.T) { links := []string{ "/explore/repos", - "/explore/repos?q=test&tab=", + "/explore/repos?q=test", "/explore/users", - "/explore/users?q=test&tab=", + "/explore/users?q=test", "/explore/organizations", - "/explore/organizations?q=test&tab=", + "/explore/organizations?q=test", "/", "/user/sign_up", "/user/login", @@ -81,11 +81,11 @@ func TestNoLoginNotExist(t *testing.T) { func testLinksAsUser(userName string, t *testing.T) { links := []string{ "/explore/repos", - "/explore/repos?q=test&tab=", + "/explore/repos?q=test", "/explore/users", - "/explore/users?q=test&tab=", + "/explore/users?q=test", "/explore/organizations", - "/explore/organizations?q=test&tab=", + "/explore/organizations?q=test", "/", "/user/forgot_password", "/api/swagger", diff --git a/modules/context/pagination.go b/modules/context/pagination.go index c0079c2950..617b472f0d 100644 --- a/modules/context/pagination.go +++ b/modules/context/pagination.go @@ -52,7 +52,6 @@ func (p *Pagination) GetParams() template.URL { func (p *Pagination) SetDefaultParams(ctx *Context) { p.AddParam(ctx, "sort", "SortType") p.AddParam(ctx, "q", "Keyword") - p.AddParam(ctx, "tab", "TabName") // do not add any more uncommon params here! p.AddParam(ctx, "t", "queryType") } diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 44501fc245..dd5804cd42 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -276,6 +276,7 @@ func Profile(ctx *context.Context) { pager := context.NewPagination(total, setting.UI.User.RepoPagingNum, page, 5) pager.SetDefaultParams(ctx) + pager.AddParam(ctx, "tab", "TabName") if tab != "followers" && tab != "following" && tab != "activity" && tab != "projects" { pager.AddParam(ctx, "language", "Language") } diff --git a/templates/admin/repo/search.tmpl b/templates/admin/repo/search.tmpl index e51d50936b..7b9c44afd7 100644 --- a/templates/admin/repo/search.tmpl +++ b/templates/admin/repo/search.tmpl @@ -12,10 +12,10 @@ {{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}} {{.i18n.Tr "repo.issues.filter_sort.recentupdate"}} {{.i18n.Tr "repo.issues.filter_sort.leastupdate"}} - {{.i18n.Tr "repo.issues.filter_sort.moststars"}} - {{.i18n.Tr "repo.issues.filter_sort.feweststars"}} - {{.i18n.Tr "repo.issues.filter_sort.mostforks"}} - {{.i18n.Tr "repo.issues.filter_sort.fewestforks"}} + {{.i18n.Tr "repo.issues.filter_sort.moststars"}} + {{.i18n.Tr "repo.issues.filter_sort.feweststars"}} + {{.i18n.Tr "repo.issues.filter_sort.mostforks"}} + {{.i18n.Tr "repo.issues.filter_sort.fewestforks"}} {{.i18n.Tr "repo.issues.label.filter_sort.by_size"}} {{.i18n.Tr "repo.issues.label.filter_sort.reverse_by_size"}} diff --git a/templates/explore/code.tmpl b/templates/explore/code.tmpl index 2801cdfaf0..6bd8be7aff 100644 --- a/templates/explore/code.tmpl +++ b/templates/explore/code.tmpl @@ -3,7 +3,6 @@ {{template "explore/navbar" .}}
-
-
-