diff options
author | mrsdizzie <info@mrsdizzie.com> | 2020-05-16 12:38:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 19:38:40 +0300 |
commit | b2b86ea8701cab901cd9e6a02c918aa5c61748d6 (patch) | |
tree | 14b590e7681a107ba6f5cf2cabcea8a4a4b4aaa4 /routers/routes/routes.go | |
parent | 6603045476e42d24606c82d5a6d740f8c06aa059 (diff) | |
download | gitea-b2b86ea8701cab901cd9e6a02c918aa5c61748d6.tar.gz gitea-b2b86ea8701cab901cd9e6a02c918aa5c61748d6.zip |
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>
Diffstat (limited to 'routers/routes/routes.go')
-rw-r--r-- | routers/routes/routes.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/routes/routes.go b/routers/routes/routes.go index a51c1e17af..7f409eb576 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -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) |