vendor: update github.com/gogs/go-gogs-client

Bring fixes for #5538
pull/5544/head
Unknwon 2018-12-03 14:45:19 -05:00
parent 6690023555
commit 98114944fc
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
6 changed files with 10 additions and 24 deletions

View File

@ -39,7 +39,7 @@ If applicable, add screenshots to help explain your problem.
- Gogs version (or commit ref): - Gogs version (or commit ref):
- Git version: - Git version:
- Operating system: - Operating system:
- Database (use `[x]`): - Database (replace `[ ]` with `[x]`):
- [ ] PostgreSQL - [ ] PostgreSQL
- [ ] MySQL - [ ] MySQL
- [ ] MSSQL - [ ] MSSQL

View File

@ -132,6 +132,7 @@ func (u *User) APIFormat() *api.User {
return &api.User{ return &api.User{
ID: u.ID, ID: u.ID,
UserName: u.Name, UserName: u.Name,
Login: u.Name,
FullName: u.FullName, FullName: u.FullName,
Email: u.Email, Email: u.Email,
AvatarUrl: u.AvatarLink(), AvatarUrl: u.AvatarLink(),

View File

@ -15,11 +15,7 @@ import (
func ListCollaborators(c *context.APIContext) { func ListCollaborators(c *context.APIContext) {
collaborators, err := c.Repo.Repository.GetCollaborators() collaborators, err := c.Repo.Repository.GetCollaborators()
if err != nil { if err != nil {
if errors.IsUserNotExist(err) { c.ServerError("GetCollaborators", err)
c.Error(422, "", err)
} else {
c.Error(500, "GetCollaborators", err)
}
return return
} }
@ -27,7 +23,7 @@ func ListCollaborators(c *context.APIContext) {
for i := range collaborators { for i := range collaborators {
apiCollaborators[i] = collaborators[i].APIFormat() apiCollaborators[i] = collaborators[i].APIFormat()
} }
c.JSON(200, &apiCollaborators) c.JSONSuccess(&apiCollaborators)
} }
func AddCollaborator(c *context.APIContext, form api.AddCollaboratorOption) { func AddCollaborator(c *context.APIContext, form api.AddCollaboratorOption) {

View File

@ -14,7 +14,7 @@ import (
) )
func Version() string { func Version() string {
return "0.12.13" return "0.12.14"
} }
// Client represents a Gogs API client. // Client represents a Gogs API client.

View File

@ -5,30 +5,19 @@
package gogs package gogs
import ( import (
"encoding/json"
"fmt" "fmt"
) )
// User represents a API user. // User represents a API user.
type User struct { type User struct {
ID int64 `json:"id"` 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"` FullName string `json:"full_name"`
Email string `json:"email"` Email string `json:"email"`
AvatarUrl string `json:"avatar_url"` 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) { func (c *Client) GetUserInfo(user string) (*User, error) {
u := new(User) u := new(User)
err := c.getParsedResponse("GET", fmt.Sprintf("/users/%s", user), nil, nil, u) err := c.getParsedResponse("GET", fmt.Sprintf("/users/%s", user), nil, nil, u)

6
vendor/vendor.json vendored
View File

@ -219,10 +219,10 @@
"revisionTime": "2018-10-23T10:58:32Z" "revisionTime": "2018-10-23T10:58:32Z"
}, },
{ {
"checksumSHA1": "zQkw7E0MzSfPem4f9eCGhue21Nw=", "checksumSHA1": "zjkjsFMM7ML0rZBOLxMU2yxHxx4=",
"path": "github.com/gogs/go-gogs-client", "path": "github.com/gogs/go-gogs-client",
"revision": "0c040274bc4e176c86a466e2ae327324fc143269", "revision": "2040be8569f298967623526418f718a86e725f9b",
"revisionTime": "2018-12-02T17:53:48Z" "revisionTime": "2018-12-03T19:42:48Z"
}, },
{ {
"checksumSHA1": "GaJLoEuMGnP5ofXvuweAI4wx06U=", "checksumSHA1": "GaJLoEuMGnP5ofXvuweAI4wx06U=",