Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition to #15675 #15690

Merged
merged 6 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/structs/admin_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ type EditUserOption struct {
FullName *string `json:"full_name" binding:"MaxSize(100)"`
Password string `json:"password" binding:"MaxSize(255)"`
MustChangePassword *bool `json:"must_change_password"`
Website *string `json:"website" binding:"MaxSize(50)"`
Website *string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location *string `json:"location" binding:"MaxSize(50)"`
Description *string `json:"description" binding:"MaxSize(255)"`
Active *bool `json:"active"`
Admin *bool `json:"admin"`
AllowGitHook *bool `json:"allow_git_hook"`
Expand Down
12 changes: 6 additions & 6 deletions modules/structs/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type CreateOrgOption struct {
// required: true
UserName string `json:"username" binding:"Required"`
FullName string `json:"full_name"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
Description string `json:"description" binding:"MaxSize(255)"`
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
// possible values are `public` (default), `limited` or `private`
// enum: public,limited,private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
Expand All @@ -34,9 +34,9 @@ type CreateOrgOption struct {
// EditOrgOption options for editing an organization
type EditOrgOption struct {
FullName string `json:"full_name"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
Description string `json:"description" binding:"MaxSize(255)"`
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
// possible values are `public`, `limited` or `private`
// enum: public,limited,private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
Expand Down
4 changes: 2 additions & 2 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type User struct {
Location string `json:"location"`
// the user's website
Website string `json:"website"`
// the user's biography
Description string `json:"bio"`
// the user's description
Description string `json:"description"`
}

// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
Expand Down
3 changes: 3 additions & 0 deletions routers/api/v1/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ func EditUser(ctx *context.APIContext) {
if form.Location != nil {
u.Location = *form.Location
}
if form.Description != nil {
u.Description = *form.Description
}
if form.Active != nil {
u.IsActive = *form.Active
}
Expand Down
14 changes: 9 additions & 5 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13800,6 +13800,10 @@
"type": "boolean",
"x-go-name": "AllowImportLocal"
},
"description": {
"type": "string",
"x-go-name": "Description"
},
"email": {
"type": "string",
"format": "email",
Expand Down Expand Up @@ -16251,16 +16255,16 @@
"type": "string",
"x-go-name": "AvatarURL"
},
"bio": {
"description": "the user's biography",
"type": "string",
"x-go-name": "Description"
},
"created": {
"type": "string",
"format": "date-time",
"x-go-name": "Created"
},
"description": {
"description": "the user's description",
"type": "string",
"x-go-name": "Description"
},
"email": {
"type": "string",
"format": "email",
Expand Down