mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
committed by
techknowlogick
parent
d95caf50ec
commit
43cf2f3b55
@ -90,6 +90,11 @@ func Create(ctx *context.APIContext, form api.CreateOrgOption) {
|
||||
return
|
||||
}
|
||||
|
||||
visibility := api.VisibleTypePublic
|
||||
if form.Visibility != "" {
|
||||
visibility = api.VisibilityModes[form.Visibility]
|
||||
}
|
||||
|
||||
org := &models.User{
|
||||
Name: form.UserName,
|
||||
FullName: form.FullName,
|
||||
@ -98,6 +103,7 @@ func Create(ctx *context.APIContext, form api.CreateOrgOption) {
|
||||
Location: form.Location,
|
||||
IsActive: true,
|
||||
Type: models.UserTypeOrganization,
|
||||
Visibility: visibility,
|
||||
}
|
||||
if err := models.CreateOrganization(org, ctx.User); err != nil {
|
||||
if models.IsErrUserAlreadyExist(err) ||
|
||||
@ -153,6 +159,7 @@ func Edit(ctx *context.APIContext, form api.EditOrgOption) {
|
||||
// required: true
|
||||
// - name: body
|
||||
// in: body
|
||||
// required: true
|
||||
// schema:
|
||||
// "$ref": "#/definitions/EditOrgOption"
|
||||
// responses:
|
||||
@ -163,8 +170,11 @@ func Edit(ctx *context.APIContext, form api.EditOrgOption) {
|
||||
org.Description = form.Description
|
||||
org.Website = form.Website
|
||||
org.Location = form.Location
|
||||
if err := models.UpdateUserCols(org, "full_name", "description", "website", "location"); err != nil {
|
||||
ctx.Error(500, "UpdateUser", err)
|
||||
if form.Visibility != "" {
|
||||
org.Visibility = api.VisibilityModes[form.Visibility]
|
||||
}
|
||||
if err := models.UpdateUserCols(org, "full_name", "description", "website", "location", "visibility"); err != nil {
|
||||
ctx.Error(500, "EditOrganization", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user