mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
fix lints
This commit is contained in:
@@ -9,16 +9,13 @@ import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/sitemap"
|
||||
"code.gitea.io/gitea/services/context"
|
||||
)
|
||||
|
||||
func RenderBadgeSearch(ctx *context.Context, opts *user_model.SearchBadgeOptions, tplName base.TplName) {
|
||||
// Sitemap index for sitemap paths
|
||||
opts.Page = int(ctx.ParamsInt64("idx"))
|
||||
isSitemap := ctx.Params("idx") != ""
|
||||
opts.Page = int(ctx.PathParamInt64("idx"))
|
||||
if opts.Page <= 1 {
|
||||
opts.Page = ctx.FormInt("page")
|
||||
}
|
||||
@@ -26,10 +23,6 @@ func RenderBadgeSearch(ctx *context.Context, opts *user_model.SearchBadgeOptions
|
||||
opts.Page = 1
|
||||
}
|
||||
|
||||
if isSitemap {
|
||||
opts.PageSize = setting.UI.SitemapPagingNum
|
||||
}
|
||||
|
||||
var (
|
||||
badges []*user_model.Badge
|
||||
count int64
|
||||
@@ -69,17 +62,6 @@ func RenderBadgeSearch(ctx *context.Context, opts *user_model.SearchBadgeOptions
|
||||
return
|
||||
}
|
||||
}
|
||||
if isSitemap {
|
||||
m := sitemap.NewSitemap()
|
||||
for _, item := range badges {
|
||||
m.Add(sitemap.URL{URL: item.HTMLURL()})
|
||||
}
|
||||
ctx.Resp.Header().Set("Content-Type", "text/xml")
|
||||
if _, err := m.WriteTo(ctx.Resp); err != nil {
|
||||
log.Error("Failed writing sitemap: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Keyword"] = opts.Keyword
|
||||
ctx.Data["Total"] = count
|
||||
|
||||
Reference in New Issue
Block a user