diff options
author | ngourdon <31291059+ngourdon@users.noreply.github.com> | 2019-04-07 15:44:34 +0200 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-04-07 14:44:34 +0100 |
commit | 592e6c398e6c05776d09822e8663928a947c5b90 (patch) | |
tree | 124297f9db8b7133a91a49710538fa3fa81fca43 /models/org_team.go | |
parent | 6293736d02992ef317c0f1ffc875cdccf0fd5837 (diff) | |
download | gitea-592e6c398e6c05776d09822e8663928a947c5b90.tar.gz gitea-592e6c398e6c05776d09822e8663928a947c5b90.zip |
Fixes #6446 - Sort team members and team's repositories (#6525)
* sort team's repositories by name
* sort team members by display name
Diffstat (limited to 'models/org_team.go')
-rw-r--r-- | models/org_team.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/models/org_team.go b/models/org_team.go index ccee9f544b..4e496e2f72 100644 --- a/models/org_team.go +++ b/models/org_team.go @@ -8,6 +8,7 @@ package models import ( "errors" "fmt" + "sort" "strings" "code.gitea.io/gitea/modules/log" @@ -77,7 +78,9 @@ func (t *Team) IsMember(userID int64) bool { func (t *Team) getRepositories(e Engine) error { return e.Join("INNER", "team_repo", "repository.id = team_repo.repo_id"). - Where("team_repo.team_id=?", t.ID).Find(&t.Repos) + Where("team_repo.team_id=?", t.ID). + OrderBy("repository.name"). + Find(&t.Repos) } // GetRepositories returns all repositories in team of organization. @@ -546,6 +549,9 @@ func getTeamMembers(e Engine, teamID int64) (_ []*User, err error) { } members[i] = member } + sort.Slice(members, func(i, j int) bool { + return members[i].DisplayName() < members[j].DisplayName() + }) return members, nil } |