diff --git a/routers/web/web.go b/routers/web/web.go index a6ccb7a792..c34fd3f4f2 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1510,6 +1510,9 @@ func registerRoutes(m *web.Router) { m.Get("/{sha}", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.ExcerptBlob) }, func(ctx *context.Context) gocontext.CancelFunc { // FIXME: refactor this function, use separate routes for wiki/code + if ctx.FormBool("pull") { + ctx.Data["PageIsPullFiles"] = true + } if ctx.FormBool("wiki") { ctx.Data["PageIsWiki"] = true repo.MustEnableWiki(ctx) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 1aef115d3d..cbc0bcbd75 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -23,9 +23,11 @@ {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}}{{/* + */}}{{if and $.SignedUserID $.PageIsPullFiles}}{{/* */}}{{/* + */}}{{end}}{{/* */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}} {{else}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}} @@ -33,9 +35,11 @@ {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.LeftIdx}}{{end}} {{/* + */}}{{if and $.SignedUserID $.PageIsPullFiles}}{{/* */}}{{/* + */}}{{end}}{{/* */}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/* */}}{{/* */}}{{end}}{{/* @@ -44,9 +48,11 @@ {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.RightIdx}}{{end}} {{/* + */}}{{if and $.SignedUserID $.PageIsPullFiles}}{{/* */}}{{/* + */}}{{end}}{{/* */}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/* */}}{{/* */}}{{end}}{{/* @@ -92,7 +98,7 @@ {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}} {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} - {{$inlineDiff.Content}} + {{if and $.SignedUserID $.PageIsPullFiles}}{{end}}{{$inlineDiff.Content}} {{if $line.Comments}} diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index 37b42bcb37..36a873208c 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -20,17 +20,17 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}} diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 708b333291..893f76b8aa 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -16,17 +16,17 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}}