mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 09:54:24 +01:00
WIP Implement proper saving of federated repo urls
Added ToDos where relevant
This commit is contained in:
parent
9337274334
commit
884e38bdab
|
@ -137,7 +137,7 @@ type Repository struct {
|
||||||
DefaultBranch string
|
DefaultBranch string
|
||||||
WikiBranch string
|
WikiBranch string
|
||||||
// TODO: Create own table out of this field
|
// TODO: Create own table out of this field
|
||||||
FederationRepos string
|
FederationRepos string `xorm:"TEXT"`
|
||||||
|
|
||||||
NumWatches int
|
NumWatches int
|
||||||
NumStars int
|
NumStars int
|
||||||
|
|
|
@ -188,7 +188,20 @@ func SettingsPost(ctx *context.Context) {
|
||||||
case "federation":
|
case "federation":
|
||||||
if !setting.Federation.Enabled {
|
if !setting.Federation.Enabled {
|
||||||
ctx.NotFound("", nil)
|
ctx.NotFound("", nil)
|
||||||
|
ctx.Flash.Info("Federation Not enabled")
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
// ToDo: Proper string handling
|
||||||
|
log.Info("web/repo/setting.go:Federation was detected as enabled.")
|
||||||
|
// ToDo: Ability to delete repos
|
||||||
|
repo.FederationRepos = repo.FederationRepos + form.FederationRepos
|
||||||
|
if err := repo_service.UpdateRepository(ctx, repo, false); err != nil {
|
||||||
|
ctx.ServerError("UpdateRepository", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Info("Repos are: %v", repo.FederationRepos)
|
||||||
|
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
|
||||||
|
ctx.Redirect(repo.Link() + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Validate semicolon separation
|
// TODO: Validate semicolon separation
|
||||||
|
|
|
@ -110,9 +110,11 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err
|
||||||
|
|
||||||
// RepoSettingForm form for changing repository settings
|
// RepoSettingForm form for changing repository settings
|
||||||
type RepoSettingForm struct {
|
type RepoSettingForm struct {
|
||||||
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||||
Description string `binding:"MaxSize(2048)"`
|
Description string `binding:"MaxSize(2048)"`
|
||||||
Website string `binding:"ValidUrl;MaxSize(1024)"`
|
Website string `binding:"ValidUrl;MaxSize(1024)"`
|
||||||
|
// ToDo: Do we need validation at this point?
|
||||||
|
FederationRepos string
|
||||||
Interval string
|
Interval string
|
||||||
MirrorAddress string
|
MirrorAddress string
|
||||||
MirrorUsername string
|
MirrorUsername string
|
||||||
|
|
Loading…
Reference in a new issue