mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 17:30:36 +00:00
more review
This commit is contained in:
parent
9ccad50b05
commit
4938d38e39
1 changed files with 3 additions and 0 deletions
|
@ -193,10 +193,12 @@ func SettingsPost(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: Use Federated Repo Struct & Update Federated Repo Table
|
// ToDo: Use Federated Repo Struct & Update Federated Repo Table
|
||||||
|
// TODO: move as much functions to some kind of service in order to keep controller clean an simple
|
||||||
switch {
|
switch {
|
||||||
// Allow clearing the field
|
// Allow clearing the field
|
||||||
case form.FederationRepos == "":
|
case form.FederationRepos == "":
|
||||||
repo.FederationRepos = ""
|
repo.FederationRepos = ""
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
case !validation.IsOfValidLength(form.FederationRepos): // ToDo: Use for public testing only. In production we might need longer strings.
|
case !validation.IsOfValidLength(form.FederationRepos): // ToDo: Use for public testing only. In production we might need longer strings.
|
||||||
ctx.Data["ERR_FederationRepos"] = true
|
ctx.Data["ERR_FederationRepos"] = true
|
||||||
|
@ -204,6 +206,7 @@ func SettingsPost(ctx *context.Context) {
|
||||||
ctx.Redirect(repo.Link() + "/settings")
|
ctx.Redirect(repo.Link() + "/settings")
|
||||||
return
|
return
|
||||||
case validation.IsValidFederatedRepoURL(form.FederationRepos):
|
case validation.IsValidFederatedRepoURL(form.FederationRepos):
|
||||||
|
// TODO: Move this validation to Domain!!
|
||||||
repo.FederationRepos = form.FederationRepos
|
repo.FederationRepos = form.FederationRepos
|
||||||
default:
|
default:
|
||||||
ctx.Data["ERR_FederationRepos"] = true
|
ctx.Data["ERR_FederationRepos"] = true
|
||||||
|
|
Loading…
Reference in a new issue