|
|
@ -52,6 +52,7 @@ func SettingsPost(ctx *context.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
org := ctx.Org.Organization |
|
|
|
org := ctx.Org.Organization |
|
|
|
|
|
|
|
nameChanged := org.Name != form.Name |
|
|
|
|
|
|
|
|
|
|
|
// Check if organization name has been changed.
|
|
|
|
// Check if organization name has been changed.
|
|
|
|
if org.LowerName != strings.ToLower(form.Name) { |
|
|
|
if org.LowerName != strings.ToLower(form.Name) { |
|
|
@ -75,7 +76,9 @@ func SettingsPost(ctx *context.Context) { |
|
|
|
// reset ctx.org.OrgLink with new name
|
|
|
|
// reset ctx.org.OrgLink with new name
|
|
|
|
ctx.Org.OrgLink = setting.AppSubURL + "/org/" + form.Name |
|
|
|
ctx.Org.OrgLink = setting.AppSubURL + "/org/" + form.Name |
|
|
|
log.Trace("Organization name changed: %s -> %s", org.Name, form.Name) |
|
|
|
log.Trace("Organization name changed: %s -> %s", org.Name, form.Name) |
|
|
|
|
|
|
|
nameChanged = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// In case it's just a case change.
|
|
|
|
// In case it's just a case change.
|
|
|
|
org.Name = form.Name |
|
|
|
org.Name = form.Name |
|
|
|
org.LowerName = strings.ToLower(form.Name) |
|
|
|
org.LowerName = strings.ToLower(form.Name) |
|
|
@ -105,11 +108,17 @@ func SettingsPost(ctx *context.Context) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
for _, repo := range org.Repos { |
|
|
|
for _, repo := range org.Repos { |
|
|
|
|
|
|
|
repo.OwnerName = org.Name |
|
|
|
if err := models.UpdateRepository(repo, true); err != nil { |
|
|
|
if err := models.UpdateRepository(repo, true); err != nil { |
|
|
|
ctx.ServerError("UpdateRepository", err) |
|
|
|
ctx.ServerError("UpdateRepository", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if nameChanged { |
|
|
|
|
|
|
|
if err := models.UpdateRepositoryOwnerNames(org.ID, org.Name); err != nil { |
|
|
|
|
|
|
|
ctx.ServerError("UpdateRepository", err) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.Trace("Organization setting updated: %s", org.Name) |
|
|
|
log.Trace("Organization setting updated: %s", org.Name) |
|
|
|