1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-13 12:18:13 +00:00

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

This commit is contained in:
Lunny Xiao
2025-09-09 21:04:32 -07:00
committed by GitHub
parent e35e724e42
commit 274f4aea7e

View File

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