forked from Gitlink/gitea-1120-rc1
fix:wiki
This commit is contained in:
parent
925a7b18cb
commit
5decf76ec3
|
@ -89,6 +89,33 @@ import (
|
|||
"gitea.com/macaron/macaron"
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func MustEnableWiki(ctx *context.Context) {
|
||||
if !ctx.Repo.CanRead(models.UnitTypeWiki) &&
|
||||
!ctx.Repo.CanRead(models.UnitTypeExternalWiki) {
|
||||
if log.IsTrace() {
|
||||
log.Trace("Permission Denied: User %-v cannot read %-v or %-v of repo %-v\n"+
|
||||
"User in repo has Permissions: %-+v",
|
||||
ctx.User,
|
||||
models.UnitTypeWiki,
|
||||
models.UnitTypeExternalWiki,
|
||||
ctx.Repo.Repository,
|
||||
ctx.Repo.Permission)
|
||||
}
|
||||
ctx.NotFound("MustEnableWiki", nil)
|
||||
return
|
||||
}
|
||||
|
||||
unit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalWiki)
|
||||
if err == nil {
|
||||
ctx.Redirect(unit.ExternalWikiConfig().ExternalWikiURL)
|
||||
return
|
||||
}
|
||||
}
|
||||
func sudo() macaron.Handler {
|
||||
return func(ctx *context.APIContext) {
|
||||
sudo := ctx.Query("sudo")
|
||||
|
@ -710,7 +737,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
Patch(bind(api.WikiOption{}), repo.EditWiki).
|
||||
Delete(repo.DeleteWiki)
|
||||
})
|
||||
})
|
||||
},MustEnableWiki, context.RepoRef())
|
||||
m.Group("/hooks", func() {
|
||||
m.Combo("").Get(repo.ListHooks).
|
||||
Post(bind(api.CreateHookOption{}), repo.CreateHook)
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/wikies"
|
||||
wiki_service "code.gitea.io/gitea/services/wiki"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sort"
|
||||
)
|
||||
|
@ -43,6 +44,12 @@ func WikiList(ctx *context.APIContext) {
|
|||
wikiCloneLink := repository.CloneWikiLink()
|
||||
wikiRepo, commit, err := wikies.FindWikiRepoCommit(ctx)
|
||||
|
||||
|
||||
|
||||
fmt.Println("wikiRepo================================\n",wikiRepo)
|
||||
|
||||
fmt.Println("repository===================\n", repository)
|
||||
|
||||
if err != nil {
|
||||
if wikiRepo != nil {
|
||||
wikiRepo.Close()
|
||||
|
@ -56,6 +63,15 @@ func WikiList(ctx *context.APIContext) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
|
||||
fmt.Println("entry",entry)
|
||||
fmt.Println("entry name",entry.Name())
|
||||
fmt.Println()
|
||||
|
||||
}
|
||||
|
||||
wikiesList := make([]api.WikiesResponse, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
if !entry.IsRegular() {
|
||||
|
|
Loading…
Reference in New Issue