Parcourir la source

Fix the bug: no wiki page can be created if the repo didn't have any page yet. (#17894)

tags/v1.16.0-rc1
wxiaoguang il y a 2 ans
Parent
révision
aa79738a66
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 6
    6
      routers/web/repo/wiki.go

+ 6
- 6
routers/web/repo/wiki.go Voir le fichier

@@ -409,12 +409,6 @@ func Wiki(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived

if !ctx.Repo.Repository.HasWiki() {
ctx.Data["Title"] = ctx.Tr("repo.wiki")
ctx.HTML(http.StatusOK, tplWikiStart)
return
}

switch ctx.FormString("action") {
case "_pages":
WikiPages(ctx)
@@ -438,6 +432,12 @@ func Wiki(ctx *context.Context) {
return
}

if !ctx.Repo.Repository.HasWiki() {
ctx.Data["Title"] = ctx.Tr("repo.wiki")
ctx.HTML(http.StatusOK, tplWikiStart)
return
}

wikiRepo, entry := renderViewPage(ctx)
defer func() {
if wikiRepo != nil {

Chargement…
Annuler
Enregistrer