]> source.dussan.org Git - gitea.git/commitdiff
Fix correct usage of teams (#17732)
authorGusted <williamzijl7@hotmail.com>
Sat, 20 Nov 2021 03:13:24 +0000 (03:13 +0000)
committerGitHub <noreply@github.com>
Sat, 20 Nov 2021 03:13:24 +0000 (11:13 +0800)
- `.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>
modules/context/org.go
templates/user/dashboard/navbar.tmpl

index 54cc3a9d8c538a0431a081e0d758d22842df4eef..11521c452b3f3724a7da616906f645d085a16ac5 100644 (file)
@@ -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
index 740929d46e6262492149a1a33c0c190bb4315f40..e995db81d8a07a4799b73d029c431f4262621091 100644 (file)
@@ -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"}}&nbsp;{{.i18n.Tr "pull_requests"}}
                        </a>
                        {{end}}