Skip to content

Commit 592e6c3

Browse files
ngourdonzeripath
authored andcommitted
Fixes #6446 - Sort team members and team's repositories (#6525)
* sort team's repositories by name * sort team members by display name
1 parent 6293736 commit 592e6c3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

models/org_team.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package models
88
import (
99
"errors"
1010
"fmt"
11+
"sort"
1112
"strings"
1213

1314
"code.gitea.io/gitea/modules/log"
@@ -77,7 +78,9 @@ func (t *Team) IsMember(userID int64) bool {
7778

7879
func (t *Team) getRepositories(e Engine) error {
7980
return e.Join("INNER", "team_repo", "repository.id = team_repo.repo_id").
80-
Where("team_repo.team_id=?", t.ID).Find(&t.Repos)
81+
Where("team_repo.team_id=?", t.ID).
82+
OrderBy("repository.name").
83+
Find(&t.Repos)
8184
}
8285

8386
// GetRepositories returns all repositories in team of organization.
@@ -546,6 +549,9 @@ func getTeamMembers(e Engine, teamID int64) (_ []*User, err error) {
546549
}
547550
members[i] = member
548551
}
552+
sort.Slice(members, func(i, j int) bool {
553+
return members[i].DisplayName() < members[j].DisplayName()
554+
})
549555
return members, nil
550556
}
551557

0 commit comments

Comments
 (0)