Skip to content

Commit 142cd71

Browse files
Gustedlunny
authored and
Stelios Malathouras
committed
Fix correct usage of teams (go-gitea#17732)
- `.Teams` isn't a field on the User type, thus using the seperate loaded teams. - Add a space between `PathEscape` and argument. Co-authored-by: Lunny Xiao <[email protected]>
1 parent 91de1e9 commit 142cd71

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

modules/context/org.go

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
6969
org := ctx.Org.Organization
7070
ctx.Data["Org"] = org
7171

72+
teams, err := org.LoadTeams()
73+
if err != nil {
74+
ctx.ServerError("LoadTeams", err)
75+
}
76+
ctx.Data["OrgTeams"] = teams
77+
7278
// Admin has super access.
7379
if ctx.IsSigned && ctx.User.IsAdmin {
7480
ctx.Org.IsOwner = true

templates/user/dashboard/navbar.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<a class="{{if not $.Team}}active selected{{end}} item" title="{{.i18n.Tr "all"}}" href="{{$.Org.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}">
6262
{{.i18n.Tr "all"}}
6363
</a>
64-
{{range .Org.Teams}}
64+
{{range .OrgTeams}}
6565
{{if not .IncludesAllRepositories}}
6666
<a class="{{if $.Team}}{{if eq $.Team.ID .ID}}active selected{{end}}{{end}} item" title="{{.Name}}" href="{{$.Org.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}/{{.Name}}">
6767
{{.Name}}
@@ -85,7 +85,7 @@
8585
</a>
8686
{{end}}
8787
{{if not .UnitPullsGlobalDisabled}}
88-
<a class="{{if .PageIsPulls}}active{{end}} item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape.Team.Name}}{{end}}">
88+
<a class="{{if .PageIsPulls}}active{{end}} item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
8989
{{svg "octicon-git-pull-request"}}&nbsp;{{.i18n.Tr "pull_requests"}}
9090
</a>
9191
{{end}}

0 commit comments

Comments
 (0)