@@ -50,7 +50,7 @@ func (org *User) GetOwnerTeam() (*Team, error) {
50
50
}
51
51
52
52
func (org * User ) getTeams (e Engine ) error {
53
- return e .Where ("org_id=?" , org .ID ).Find (& org .Teams )
53
+ return e .Where ("org_id=?" , org .ID ).OrderBy ( "CASE WHEN name LIKE '" + OWNER_TEAM + "' THEN '' ELSE name END" ). Find (& org .Teams )
54
54
}
55
55
56
56
// GetTeams returns all teams that belong to organization.
@@ -495,7 +495,7 @@ func (org *User) GetUserRepositories(userID int64, page, pageSize int) ([]*Repos
495
495
repos := make ([]* Repository , 0 , pageSize )
496
496
// FIXME: use XORM chain operations instead of raw SQL.
497
497
if err = x .Sql (fmt .Sprintf (`SELECT repository.* FROM repository
498
- INNER JOIN team_repo
498
+ INNER JOIN team_repo
499
499
ON team_repo.repo_id = repository.id
500
500
WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s)
501
501
GROUP BY repository.id
@@ -507,7 +507,7 @@ func (org *User) GetUserRepositories(userID int64, page, pageSize int) ([]*Repos
507
507
}
508
508
509
509
results , err := x .Query (fmt .Sprintf (`SELECT repository.id FROM repository
510
- INNER JOIN team_repo
510
+ INNER JOIN team_repo
511
511
ON team_repo.repo_id = repository.id
512
512
WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s)
513
513
GROUP BY repository.id
@@ -534,7 +534,7 @@ func (org *User) GetUserMirrorRepositories(userID int64) ([]*Repository, error)
534
534
535
535
repos := make ([]* Repository , 0 , 10 )
536
536
if err = x .Sql (fmt .Sprintf (`SELECT repository.* FROM repository
537
- INNER JOIN team_repo
537
+ INNER JOIN team_repo
538
538
ON team_repo.repo_id = repository.id AND repository.is_mirror = ?
539
539
WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s)
540
540
GROUP BY repository.id
0 commit comments