Skip to content

Commit d138ca6

Browse files
add LoadHeaderCount function for group pages
1 parent db5d41c commit d138ca6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

routers/web/shared/group/header.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package group
2+
3+
import (
4+
repo_model "code.gitea.io/gitea/models/repo"
5+
"code.gitea.io/gitea/modules/optional"
6+
"code.gitea.io/gitea/modules/setting"
7+
"code.gitea.io/gitea/services/context"
8+
)
9+
10+
func LoadHeaderCount(ctx *context.Context) error {
11+
repoCount, err := repo_model.CountRepository(ctx, repo_model.SearchRepoOptions{
12+
Actor: ctx.Doer,
13+
Private: ctx.IsSigned,
14+
GroupID: ctx.RepoGroup.Group.ID,
15+
Collaborate: optional.Some(false),
16+
IncludeDescription: setting.UI.SearchRepoDescription,
17+
})
18+
if err != nil {
19+
return err
20+
}
21+
ctx.Data["RepoCount"] = repoCount
22+
23+
return nil
24+
}

0 commit comments

Comments
 (0)