File tree Expand file tree Collapse file tree 5 files changed +14
-10
lines changed Expand file tree Collapse file tree 5 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ func Branches(ctx *context.Context) {
47
47
ctx .Data ["PageIsViewCode" ] = true
48
48
ctx .Data ["PageIsBranches" ] = true
49
49
50
- if ! shared .RenderRepoSubMenu (ctx ) {
50
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
51
51
return
52
52
}
53
53
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ func Commits(ctx *context.Context) {
62
62
}
63
63
ctx .Data ["PageIsViewCode" ] = true
64
64
65
- if ! shared .RenderRepoSubMenu (ctx ) {
65
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
66
66
return
67
67
}
68
68
@@ -201,7 +201,7 @@ func SearchCommits(ctx *context.Context) {
201
201
ctx .Data ["PageIsCommits" ] = true
202
202
ctx .Data ["PageIsViewCode" ] = true
203
203
204
- if ! shared .RenderRepoSubMenu (ctx ) {
204
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
205
205
return
206
206
}
207
207
@@ -233,7 +233,7 @@ func SearchCommits(ctx *context.Context) {
233
233
234
234
// FileHistory show a file's reversions
235
235
func FileHistory (ctx * context.Context ) {
236
- if ! shared .RenderRepoSubMenu (ctx ) {
236
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
237
237
return
238
238
}
239
239
Original file line number Diff line number Diff line change @@ -157,8 +157,9 @@ func Releases(ctx *context.Context) {
157
157
ctx .Data ["CanCreateBranch" ] = false
158
158
ctx .Data ["HideBranchesInDropdown" ] = true
159
159
160
+ // repo/release_tag_header.tmpl will render sub menu depending on the different permission
160
161
if ! ctx .Repo .CanRead (unit .TypeReleases ) && ctx .Repo .CanRead (unit .TypeCode ) {
161
- if ! shared .RenderRepoSubMenu (ctx ) {
162
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
162
163
return
163
164
}
164
165
}
@@ -214,8 +215,9 @@ func TagsList(ctx *context.Context) {
214
215
ctx .Data ["HideBranchesInDropdown" ] = true
215
216
ctx .Data ["CanCreateRelease" ] = ctx .Repo .CanWrite (unit .TypeReleases ) && ! ctx .Repo .Repository .IsArchived
216
217
218
+ // repo/release_tag_header.tmpl will render sub menu depending on the different permission
217
219
if ! ctx .Repo .CanRead (unit .TypeReleases ) && ctx .Repo .CanRead (unit .TypeCode ) {
218
- if ! shared .RenderRepoSubMenu (ctx ) {
220
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
219
221
return
220
222
}
221
223
}
Original file line number Diff line number Diff line change @@ -9,11 +9,13 @@ import (
9
9
repo_service "code.gitea.io/gitea/services/repository"
10
10
)
11
11
12
- func RenderRepoSubMenu (ctx * context.Context ) bool {
13
- return renderLicenses (ctx )
12
+ // PrepareForRepoSubMenu will prepare all sub menus' data for some repositories pages
13
+ // TODO: moving prepae commits count, branches count, tags count and repository size to this function
14
+ func PrepareForRepoSubMenu (ctx * context.Context ) bool {
15
+ return prepareForLicenses (ctx )
14
16
}
15
17
16
- func renderLicenses (ctx * context.Context ) bool {
18
+ func prepareForLicenses (ctx * context.Context ) bool {
17
19
repoLicenses , err := repo_model .GetRepoLicenses (ctx , ctx .Repo .Repository )
18
20
if err != nil {
19
21
ctx .ServerError ("GetRepoLicenses" , err )
Original file line number Diff line number Diff line change @@ -981,7 +981,7 @@ func renderHomeCode(ctx *context.Context) {
981
981
return
982
982
}
983
983
984
- if ! shared .RenderRepoSubMenu (ctx ) {
984
+ if ! shared .PrepareForRepoSubMenu (ctx ) {
985
985
return
986
986
}
987
987
You can’t perform that action at this time.
0 commit comments