diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-09-29 05:27:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-29 05:27:33 +0200 |
commit | b7309b8ccb16f6303ae300b755baef9f9713d457 (patch) | |
tree | cab46a2eafee748123b76f1d52d00037d44a4bd9 /modules | |
parent | 1dfa28ffa557720d164a351783be64c9a47a0adb (diff) | |
download | gitea-b7309b8ccb16f6303ae300b755baef9f9713d457.tar.gz gitea-b7309b8ccb16f6303ae300b755baef9f9713d457.zip |
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.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/convert/convert.go | 1 | ||||
-rw-r--r-- | modules/structs/org.go | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/modules/convert/convert.go b/modules/convert/convert.go index 0e67563077..af759cb938 100644 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -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, diff --git a/modules/structs/org.go b/modules/structs/org.go index d8bd59e1ec..1e98c59ba4 100644 --- a/modules/structs/org.go +++ b/modules/structs/org.go @@ -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 |