aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/shared/user/header.go
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-08-11 19:08:05 +0200
committerGitHub <noreply@github.com>2023-08-11 13:08:05 -0400
commitf3fbb7c67d21c01a58653c7ef9ae0e80dbb4becd (patch)
tree8989d303f376193c50db1eaec57caa1b89e33fff /routers/web/shared/user/header.go
parent7e382a55558d4a8719e8493de5455883a2003759 (diff)
downloadgitea-f3fbb7c67d21c01a58653c7ef9ae0e80dbb4becd.tar.gz
gitea-f3fbb7c67d21c01a58653c7ef9ae0e80dbb4becd.zip
Count only visible repos on profile (#25928)
Fixes #25914
Diffstat (limited to 'routers/web/shared/user/header.go')
-rw-r--r--routers/web/shared/user/header.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/routers/web/shared/user/header.go b/routers/web/shared/user/header.go
index 0ef93815a3..9b1918ed16 100644
--- a/routers/web/shared/user/header.go
+++ b/routers/web/shared/user/header.go
@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
)
// prepareContextForCommonProfile store some common data into context data for user's profile related pages (including the nav menu)
@@ -110,3 +111,21 @@ func RenderUserHeader(ctx *context.Context) {
defer profileClose()
ctx.Data["HasProfileReadme"] = profileReadmeBlob != nil
}
+
+func LoadHeaderCount(ctx *context.Context) error {
+ prepareContextForCommonProfile(ctx)
+
+ repoCount, err := repo_model.CountRepository(ctx, &repo_model.SearchRepoOptions{
+ Actor: ctx.Doer,
+ OwnerID: ctx.ContextUser.ID,
+ Private: ctx.IsSigned,
+ Collaborate: util.OptionalBoolFalse,
+ IncludeDescription: setting.UI.SearchRepoDescription,
+ })
+ if err != nil {
+ return err
+ }
+ ctx.Data["RepoCount"] = repoCount
+
+ return nil
+}