mirror of https://github.com/gogs/gogs.git
parent
6690023555
commit
98114944fc
|
@ -39,7 +39,7 @@ If applicable, add screenshots to help explain your problem.
|
|||
- Gogs version (or commit ref):
|
||||
- Git version:
|
||||
- Operating system:
|
||||
- Database (use `[x]`):
|
||||
- Database (replace `[ ]` with `[x]`):
|
||||
- [ ] PostgreSQL
|
||||
- [ ] MySQL
|
||||
- [ ] MSSQL
|
||||
|
|
|
@ -132,6 +132,7 @@ func (u *User) APIFormat() *api.User {
|
|||
return &api.User{
|
||||
ID: u.ID,
|
||||
UserName: u.Name,
|
||||
Login: u.Name,
|
||||
FullName: u.FullName,
|
||||
Email: u.Email,
|
||||
AvatarUrl: u.AvatarLink(),
|
||||
|
|
|
@ -15,11 +15,7 @@ import (
|
|||
func ListCollaborators(c *context.APIContext) {
|
||||
collaborators, err := c.Repo.Repository.GetCollaborators()
|
||||
if err != nil {
|
||||
if errors.IsUserNotExist(err) {
|
||||
c.Error(422, "", err)
|
||||
} else {
|
||||
c.Error(500, "GetCollaborators", err)
|
||||
}
|
||||
c.ServerError("GetCollaborators", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -27,7 +23,7 @@ func ListCollaborators(c *context.APIContext) {
|
|||
for i := range collaborators {
|
||||
apiCollaborators[i] = collaborators[i].APIFormat()
|
||||
}
|
||||
c.JSON(200, &apiCollaborators)
|
||||
c.JSONSuccess(&apiCollaborators)
|
||||
}
|
||||
|
||||
func AddCollaborator(c *context.APIContext, form api.AddCollaboratorOption) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func Version() string {
|
||||
return "0.12.13"
|
||||
return "0.12.14"
|
||||
}
|
||||
|
||||
// Client represents a Gogs API client.
|
||||
|
|
|
@ -5,30 +5,19 @@
|
|||
package gogs
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// User represents a API user.
|
||||
type User struct {
|
||||
ID int64 `json:"id"`
|
||||
UserName string `json:"login"`
|
||||
UserName string `json:"username"` // LEGACY [Gogs 1.0]: remove field(s) for backward compatibility
|
||||
Login string `json:"login"`
|
||||
FullName string `json:"full_name"`
|
||||
Email string `json:"email"`
|
||||
AvatarUrl string `json:"avatar_url"`
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface for User
|
||||
func (u User) MarshalJSON() ([]byte, error) {
|
||||
// Re-declaring User to avoid recursion
|
||||
type shadow User
|
||||
return json.Marshal(struct {
|
||||
shadow
|
||||
// LEGACY [Gogs 1.0]: remove field(s) for backward compatibility
|
||||
CompatUserName string `json:"username"`
|
||||
}{shadow(u), u.UserName})
|
||||
}
|
||||
|
||||
func (c *Client) GetUserInfo(user string) (*User, error) {
|
||||
u := new(User)
|
||||
err := c.getParsedResponse("GET", fmt.Sprintf("/users/%s", user), nil, nil, u)
|
||||
|
|
|
@ -219,10 +219,10 @@
|
|||
"revisionTime": "2018-10-23T10:58:32Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "zQkw7E0MzSfPem4f9eCGhue21Nw=",
|
||||
"checksumSHA1": "zjkjsFMM7ML0rZBOLxMU2yxHxx4=",
|
||||
"path": "github.com/gogs/go-gogs-client",
|
||||
"revision": "0c040274bc4e176c86a466e2ae327324fc143269",
|
||||
"revisionTime": "2018-12-02T17:53:48Z"
|
||||
"revision": "2040be8569f298967623526418f718a86e725f9b",
|
||||
"revisionTime": "2018-12-03T19:42:48Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "GaJLoEuMGnP5ofXvuweAI4wx06U=",
|
||||
|
|
Loading…
Reference in New Issue