mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor repo unit "disabled" check (#31389)
1. There are already global "unit consts", no need to use context data, which is fragile 2. Remove the "String()" method from "unit", it would only cause rendering problems in templates --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -81,17 +81,17 @@
|
||||
<a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
{{svg "octicon-rss"}} {{ctx.Locale.Tr "activities"}}
|
||||
</a>
|
||||
{{if not .UnitIssuesGlobalDisabled}}
|
||||
{{if not ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
|
||||
<a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "issues"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if not .UnitPullsGlobalDisabled}}
|
||||
{{if not ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
|
||||
<a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
{{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "pull_requests"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if and .ShowMilestonesDashboardPage (not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled))}}
|
||||
{{if and .ShowMilestonesDashboardPage (not (and ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled))}}
|
||||
<a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
{{svg "octicon-milestone"}} {{ctx.Locale.Tr "milestones"}}
|
||||
</a>
|
||||
|
Reference in New Issue
Block a user