Add name field for org api (#21270)

related #21205

The field `UserName` is not really usefull for an organization.
This adds a second `Name` field.

The [GitHub API](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) uses `name` too. `UserName` should be deprecated then.
This commit is contained in:
KN4CK3R 2022-09-29 05:27:33 +02:00 committed by GitHub
parent 1dfa28ffa5
commit b7309b8ccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 5 deletions

View file

@ -296,6 +296,7 @@ func ToOrganization(org *organization.Organization) *api.Organization {
return &api.Organization{
ID: org.ID,
AvatarURL: org.AsUser().AvatarLink(),
Name: org.Name,
UserName: org.Name,
FullName: org.FullName,
Description: org.Description,

View file

@ -7,7 +7,7 @@ package structs
// Organization represents an organization
type Organization struct {
ID int64 `json:"id"`
UserName string `json:"username"`
Name string `json:"name"`
FullName string `json:"full_name"`
AvatarURL string `json:"avatar_url"`
Description string `json:"description"`
@ -15,6 +15,8 @@ type Organization struct {
Location string `json:"location"`
Visibility string `json:"visibility"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
// deprecated
UserName string `json:"username"`
}
// OrganizationPermissions list different users permissions on an organization