diff options
author | Gusted <williamzijl7@hotmail.com> | 2021-11-20 03:13:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-20 11:13:24 +0800 |
commit | 9f14fe43c6de96ce7cf81c87620fcd50e086910c (patch) | |
tree | 07ad012b753b0a1ce6afe547004ed7081befe145 | |
parent | 52869ef386070a3f35751a71d8d2c87b012b5a6e (diff) | |
download | gitea-9f14fe43c6de96ce7cf81c87620fcd50e086910c.tar.gz gitea-9f14fe43c6de96ce7cf81c87620fcd50e086910c.zip |
Fix correct usage of teams (#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 <xiaolunwen@gmail.com>
-rw-r--r-- | modules/context/org.go | 6 | ||||
-rw-r--r-- | templates/user/dashboard/navbar.tmpl | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/context/org.go b/modules/context/org.go index 54cc3a9d8c..11521c452b 100644 --- a/modules/context/org.go +++ b/modules/context/org.go @@ -69,6 +69,12 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { org := ctx.Org.Organization ctx.Data["Org"] = org + teams, err := org.LoadTeams() + if err != nil { + ctx.ServerError("LoadTeams", err) + } + ctx.Data["OrgTeams"] = teams + // Admin has super access. if ctx.IsSigned && ctx.User.IsAdmin { ctx.Org.IsOwner = true diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index 740929d46e..e995db81d8 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -61,7 +61,7 @@ <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}}"> {{.i18n.Tr "all"}} </a> - {{range .Org.Teams}} + {{range .OrgTeams}} {{if not .IncludesAllRepositories}} <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}}"> {{.Name}} @@ -85,7 +85,7 @@ </a> {{end}} {{if not .UnitPullsGlobalDisabled}} - <a class="{{if .PageIsPulls}}active{{end}} item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape.Team.Name}}{{end}}"> + <a class="{{if .PageIsPulls}}active{{end}} item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> {{svg "octicon-git-pull-request"}} {{.i18n.Tr "pull_requests"}} </a> {{end}} |