Only show accessible teams in dashboard dropdown list (#19642)

Fixes #19637
tokarchuk/v1.17
Jimmy Praet 3 years ago committed by GitHub
parent 672e5a752d
commit 38d72d40f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      modules/context/org.go
  2. 2
      templates/user/dashboard/navbar.tmpl

@ -72,12 +72,6 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
ctx.ContextUser = org.AsUser() ctx.ContextUser = org.AsUser()
ctx.Data["Org"] = org ctx.Data["Org"] = org
teams, err := org.LoadTeams()
if err != nil {
ctx.ServerError("LoadTeams", err)
}
ctx.Data["OrgTeams"] = teams
// Admin has super access. // Admin has super access.
if ctx.IsSigned && ctx.Doer.IsAdmin { if ctx.IsSigned && ctx.Doer.IsAdmin {
ctx.Org.IsOwner = true ctx.Org.IsOwner = true

@ -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}}"> <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"}} {{.i18n.Tr "all"}}
</a> </a>
{{range .OrgTeams}} {{range .Teams}}
{{if not .IncludesAllRepositories}} {{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}}"> <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}} {{.Name}}

Loading…
Cancel
Save