mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(team): show public teams to non-members
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
2 files changed
+14
-2
No files matched your search
@@ -184,8 +184,10 @@ $ tea team view 2 --json units`,
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, team)
|
||||
}
|
||||
// Gitea shows a public team to non-members of its organization, but not its members.
|
||||
members, err := service.Members(cmd.Context(), team.ID, teamViewNames, 1)
|
||||
if err != nil {
|
||||
membersHidden := services.IsForbidden(err)
|
||||
if err != nil && !membersHidden {
|
||||
return err
|
||||
}
|
||||
repos, err := service.Repositories(cmd.Context(), team.ID, teamViewNames, 1)
|
||||
@@ -199,6 +201,10 @@ $ tea team view 2 --json units`,
|
||||
units = append(units, strings.TrimPrefix(unit, "repo.")+": "+access)
|
||||
}
|
||||
}
|
||||
memberNames := ""
|
||||
if !membersHidden {
|
||||
memberNames = listedNames(members, func(member services.OrganizationMember) string { return member.Username })
|
||||
}
|
||||
repositories := listedNames(repos, func(repo services.Repository) string { return repo.FullName })
|
||||
if team.AllRepositories {
|
||||
repositories = "all repositories of " + team.Organization
|
||||
@@ -208,7 +214,7 @@ $ tea team view 2 --json units`,
|
||||
Fields: []terminal.Field{
|
||||
{Label: "Access", Value: team.Access(), PipedOnly: true},
|
||||
{Label: "Units", Value: strings.Join(units, ", ")},
|
||||
{Label: "Members", Value: listedNames(members, func(member services.OrganizationMember) string { return member.Username })},
|
||||
{Label: "Members", Value: memberNames},
|
||||
{Label: "Repositories", Value: repositories},
|
||||
{Label: "Can create repos", Value: yesNo(team.CanCreateRepo)},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user