diff --git a/components/components.go b/components/components.go index 17ad772eee..6106bd9ebe 100644 --- a/components/components.go +++ b/components/components.go @@ -17,7 +17,7 @@ func SVG(icon string, others ...any) g.Node { } // Utility to add "active" class if condition is true -func classIf(condition bool, class string) string { +func classIf(condition bool, class string) string { //nolint:unparam if condition { return class } diff --git a/components/explore_navbar.go b/components/explore_navbar.go index e060f67540..2edb2c35dc 100644 --- a/components/explore_navbar.go +++ b/components/explore_navbar.go @@ -10,7 +10,7 @@ import ( type ExploreNavbarProps struct { PageIsExploreRepositories bool UsersPageIsDisabled bool - AppSubUrl string + AppSubURL string PageIsExploreUsers bool PageIsExploreCode bool IsRepoIndexerEnabled bool @@ -33,14 +33,14 @@ func ExploreNavbar(data ExploreNavbarProps) g.Node { gh.Class("overflow-menu-items tw-justify-center"), gh.A( gh.Class(classIf(data.PageIsExploreRepositories, "active ")+"item"), - gh.Href(data.AppSubUrl+"/explore/repos"), + gh.Href(data.AppSubURL+"/explore/repos"), SVG("octicon-repo"), g.Text(" "+tr("explore.repos")), ), If(!data.UsersPageIsDisabled, gh.A( gh.Class(classIf(data.PageIsExploreUsers, "active ")+"item"), - gh.Href(data.AppSubUrl+"/explore/users"), + gh.Href(data.AppSubURL+"/explore/users"), SVG("octicon-person"), g.Text(" "+tr("explore.users")), ), @@ -48,7 +48,7 @@ func ExploreNavbar(data ExploreNavbarProps) g.Node { If(!data.OrganizationsPageIsDisabled, gh.A( gh.Class(classIf(data.PageIsExploreOrganizations, "active ")+"item"), - gh.Href(data.AppSubUrl+"/explore/organizations"), + gh.Href(data.AppSubURL+"/explore/organizations"), SVG("octicon-organization"), g.Text(" "+tr("explore.organizations")), ), @@ -56,7 +56,7 @@ func ExploreNavbar(data ExploreNavbarProps) g.Node { If(!isCodeGlobalDisabled && data.IsRepoIndexerEnabled && !data.CodePageIsDisabled, gh.A( gh.Class(classIf(data.PageIsExploreCode, "active ")+"item"), - gh.Href(data.AppSubUrl+"/explore/code"), + gh.Href(data.AppSubURL+"/explore/code"), SVG("octicon-code"), g.Text(" "+tr("explore.code")), ), diff --git a/components/user_list.go b/components/user_list.go index a920177c49..6e684e91b9 100644 --- a/components/user_list.go +++ b/components/user_list.go @@ -35,7 +35,7 @@ func UserList(data UserListProps) g.Node { return gh.Div( gh.Class("flex-list"), - g.Group(g.Map(data.Users, func(u *user.User) g.Node { + g.Map(data.Users, func(u *user.User) g.Node { utils := templates.NewAvatarUtils(data.Context) return gh.Div( @@ -86,6 +86,6 @@ func UserList(data UserListProps) g.Node { ), ), ) - })), + }), ) } diff --git a/modules/templates/htmlrenderer.go b/modules/templates/htmlrenderer.go index 2667cc9380..abb65c1183 100644 --- a/modules/templates/htmlrenderer.go +++ b/modules/templates/htmlrenderer.go @@ -57,7 +57,7 @@ func (h *HTMLRender) HTML(w io.Writer, status int, tplName TplName, data any, ct return t.Execute(w, data) } -func (h *HTMLRender) Gomponents(w io.Writer, status int, data []byte) error { //nolint:revive +func (h *HTMLRender) Gomponents(w io.Writer, status int, data []byte) error { if respWriter, ok := w.(http.ResponseWriter); ok { if respWriter.Header().Get("Content-Type") == "" { respWriter.Header().Set("Content-Type", "text/html; charset=utf-8") diff --git a/routers/web/explore/user.go b/routers/web/explore/user.go index ebfb39d7cf..52248aa9ad 100644 --- a/routers/web/explore/user.go +++ b/routers/web/explore/user.go @@ -232,7 +232,11 @@ func RenderUserSearch2(ctx *context.Context, opts user_model.SearchUserOptions, }) var bodyBuffer bytes.Buffer - data.Render(&bodyBuffer) + err = data.Render(&bodyBuffer) + if err != nil { + ctx.ServerError("RenderUserSearch().data.Render", err) + return + } ctx.Gomponents(http.StatusOK, bodyBuffer.String(), "ExploreUsersPage") } diff --git a/services/contexttest/context_tests.go b/services/contexttest/context_tests.go index e08b07677b..ff1fdf6e03 100644 --- a/services/contexttest/context_tests.go +++ b/services/contexttest/context_tests.go @@ -199,7 +199,7 @@ func (tr *MockRender) HTML(w io.Writer, status int, _ templates.TplName, _ any, return nil } -func (tr *MockRender) Gomponents(w io.Writer, status int, _ string) error { +func (tr *MockRender) Gomponents(w io.Writer, status int, _ []byte) error { if resp, ok := w.(http.ResponseWriter); ok { resp.WriteHeader(status) }