1
0
Fork 0
forked from forgejo/forgejo

Support view individual commit for wiki pages (#11415)

Currently you can see a list of commit history for wiki pages but aren't able to view the commit diff itself. This adds the feature to view an individual commit to a wiki repo.

Closes #8999

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
mrsdizzie 2020-05-16 12:38:40 -04:00 committed by GitHub
parent 6603045476
commit b2b86ea870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 9 deletions

View file

@ -857,6 +857,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/?:page", repo.Wiki)
m.Get("/_pages", repo.WikiPages)
m.Get("/:page/_revision", repo.WikiRevision)
m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.Diff)
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.RawDiff)
m.Group("", func() {
m.Combo("/_new").Get(repo.NewWiki).
@ -865,7 +867,9 @@ func RegisterRoutes(m *macaron.Macaron) {
Post(bindIgnErr(auth.NewWikiForm{}), repo.EditWikiPost)
m.Post("/:page/delete", repo.DeleteWikiPagePost)
}, context.RepoMustNotBeArchived(), reqSignIn, reqRepoWikiWriter)
}, repo.MustEnableWiki, context.RepoRef())
}, repo.MustEnableWiki, context.RepoRef(), func(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
})
m.Group("/wiki", func() {
m.Get("/raw/*", repo.WikiRaw)