Browse Source

Fix a compare page 404 bug when the pull request disabled (#35441) (#35453)

Backport #35441 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
pull/35669/head
Giteabot 3 months ago committed by GitHub
parent
commit
67977f0b1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      routers/web/repo/compare.go

3
routers/web/repo/compare.go

@ -523,7 +523,7 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo { @@ -523,7 +523,7 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo {
// Treat as pull request if both references are branches
if ctx.Data["PageIsComparePull"] == nil {
ctx.Data["PageIsComparePull"] = headIsBranch && baseIsBranch
ctx.Data["PageIsComparePull"] = headIsBranch && baseIsBranch && permBase.CanReadIssuesOrPulls(true)
}
if ctx.Data["PageIsComparePull"] == true && !permBase.CanReadIssuesOrPulls(true) {
@ -735,6 +735,7 @@ func CompareDiff(ctx *context.Context) { @@ -735,6 +735,7 @@ func CompareDiff(ctx *context.Context) {
return
}
ctx.Data["PageIsViewCode"] = true
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
ctx.Data["DirectComparison"] = ci.DirectComparison
ctx.Data["OtherCompareSeparator"] = ".."

Loading…
Cancel
Save