@@ -28,6 +28,7 @@ import (
2828 "code.gitea.io/gitea/modules/markup"
2929 "code.gitea.io/gitea/modules/setting"
3030 "code.gitea.io/gitea/modules/util"
31+ "code.gitea.io/gitea/routers/web/repo/shared"
3132 "code.gitea.io/gitea/services/context"
3233 "code.gitea.io/gitea/services/gitdiff"
3334 repo_service "code.gitea.io/gitea/services/repository"
@@ -61,9 +62,7 @@ func Commits(ctx *context.Context) {
6162 }
6263 ctx .Data ["PageIsViewCode" ] = true
6364
64- commitsCount , err := ctx .Repo .GetCommitsCount ()
65- if err != nil {
66- ctx .ServerError ("GetCommitsCount" , err )
65+ if ! shared .PrepareRepoSubMenu (ctx ) {
6766 return
6867 }
6968
@@ -97,9 +96,9 @@ func Commits(ctx *context.Context) {
9796 }
9897 ctx .Data ["Username" ] = ctx .Repo .Owner .Name
9998 ctx .Data ["Reponame" ] = ctx .Repo .Repository .Name
100- ctx .Data ["CommitCount" ] = commitsCount
99+ ctx .Data ["CommitCount" ] = ctx . Repo . CommitsCount
101100
102- pager := context .NewPagination (int (commitsCount ), pageSize , page , 5 )
101+ pager := context .NewPagination (int (ctx . Repo . CommitsCount ), pageSize , page , 5 )
103102 pager .SetDefaultParams (ctx )
104103 ctx .Data ["Page" ] = pager
105104 ctx .HTML (http .StatusOK , tplCommits )
@@ -196,6 +195,10 @@ func SearchCommits(ctx *context.Context) {
196195 ctx .Data ["PageIsCommits" ] = true
197196 ctx .Data ["PageIsViewCode" ] = true
198197
198+ if ! shared .PrepareRepoSubMenu (ctx ) {
199+ return
200+ }
201+
199202 query := ctx .FormTrim ("q" )
200203 if len (query ) == 0 {
201204 ctx .Redirect (ctx .Repo .RepoLink + "/commits/" + ctx .Repo .BranchNameSubURL ())
@@ -230,6 +233,10 @@ func FileHistory(ctx *context.Context) {
230233 return
231234 }
232235
236+ if ! shared .PrepareRepoSubMenu (ctx ) {
237+ return
238+ }
239+
233240 commitsCount , err := ctx .Repo .GitRepo .FileCommitsCount (ctx .Repo .RefName , fileName )
234241 if err != nil {
235242 ctx .ServerError ("FileCommitsCount" , err )
0 commit comments