1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-05 00:58:19 +00:00

Display pull request in merged commit view (#35202)

Fixes #34634

---

I am not a Web dev so I'm open to any change on the design. The
important thing for me is to have the feature implemented.

Here are screenshots on a test instance:

<img width="2758" height="420" alt="Capture d'écran 2025-08-02 161710"
src="https://github.com/user-attachments/assets/30abbeb5-6139-4a91-9348-36e78f1646e6"
/>

<img width="2769" height="520" alt="Capture d'écran 2025-08-02 161725"
src="https://github.com/user-attachments/assets/29871f05-f0b5-4a31-9ada-812780269c7d"
/>
This commit is contained in:
Nicolas Auvray
2025-08-05 01:30:12 +02:00
committed by GitHub
parent 67d623580b
commit c760e3b2b5
3 changed files with 14 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import (
asymkey_model "code.gitea.io/gitea/models/asymkey"
"code.gitea.io/gitea/models/db"
git_model "code.gitea.io/gitea/models/git"
issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/renderhelper"
repo_model "code.gitea.io/gitea/models/repo"
unit_model "code.gitea.io/gitea/models/unit"
@@ -411,6 +412,11 @@ func Diff(ctx *context.Context) {
}
}
pr, _ := issues_model.GetPullRequestByMergedCommit(ctx, ctx.Repo.Repository.ID, commitID)
if pr != nil {
ctx.Data["MergedPRIssueNumber"] = pr.Index
}
ctx.HTML(http.StatusOK, tplCommitPage)
}