Add DefaultWikiFormat var and its checks

This commit is contained in:
Aly Sewelam
2025-11-26 16:33:31 +02:00
parent 997ce9ffd1
commit f0c005be7d
4 changed files with 7 additions and 2 deletions
+1
View File
@@ -164,6 +164,7 @@ type Repository struct {
OriginalURL string `xorm:"VARCHAR(2048)"`
DefaultBranch string
DefaultWikiBranch string
DefaultWikiFormat string
NumWatches int
NumStars int
+3
View File
@@ -524,6 +524,9 @@ func handleSettingsPostAdvanced(ctx *context.Context) {
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeCode)
}
if form.EnableWiki && form.DefaultWikiFormat {
}
if form.EnableWiki && form.EnableExternalWiki && !unit_model.TypeExternalWiki.UnitGlobalDisabled() {
if !validation.IsValidExternalURL(form.ExternalWikiURL) {
ctx.Flash.Error(ctx.Tr("repo.settings.external_wiki_url_error"))
+1
View File
@@ -110,6 +110,7 @@ type RepoSettingForm struct {
// Advanced settings
EnableCode bool
DefaultWikiFormat string
EnableWiki bool
EnableExternalWiki bool
DefaultWikiBranch string
+2 -2
View File
@@ -279,7 +279,7 @@ func TestPrepareWikiFileName(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
webPath := UserTitleToWebPath("", tt.arg)
existence, newWikiPath, err := prepareGitPath(gitRepo, repo.DefaultWikiBranch, webPath)
existence, newWikiPath, err := prepareGitPath(gitRepo, repo.DefaultWikiBranch, webPath, "both")
if (err != nil) != tt.wantErr {
assert.NoError(t, err)
return
@@ -310,7 +310,7 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) {
defer gitRepo.Close()
existence, newWikiPath, err := prepareGitPath(gitRepo, "master", "Home")
existence, newWikiPath, err := prepareGitPath(gitRepo, "master", "Home", "both")
assert.False(t, existence)
assert.NoError(t, err)
assert.Equal(t, "Home.md", newWikiPath)