mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-13 10:22:17 +01:00
Add DefaultWikiFormat var and its checks
This commit is contained in:
parent
997ce9ffd1
commit
f0c005be7d
@ -164,6 +164,7 @@ type Repository struct {
|
||||
OriginalURL string `xorm:"VARCHAR(2048)"`
|
||||
DefaultBranch string
|
||||
DefaultWikiBranch string
|
||||
DefaultWikiFormat string
|
||||
|
||||
NumWatches int
|
||||
NumStars int
|
||||
|
||||
@ -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"))
|
||||
|
||||
@ -110,6 +110,7 @@ type RepoSettingForm struct {
|
||||
// Advanced settings
|
||||
EnableCode bool
|
||||
|
||||
DefaultWikiFormat string
|
||||
EnableWiki bool
|
||||
EnableExternalWiki bool
|
||||
DefaultWikiBranch string
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user