mirror of
https://github.com/go-gitea/gitea
synced 2025-08-05 17:18:21 +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:
@@ -1322,6 +1322,7 @@ commit_graph.color = Color
|
|||||||
commit.contained_in = This commit is contained in:
|
commit.contained_in = This commit is contained in:
|
||||||
commit.contained_in_default_branch = This commit is part of the default branch
|
commit.contained_in_default_branch = This commit is part of the default branch
|
||||||
commit.load_referencing_branches_and_tags = Load branches and tags referencing this commit
|
commit.load_referencing_branches_and_tags = Load branches and tags referencing this commit
|
||||||
|
commit.merged_in_pr = This commit was merged in pull request %s.
|
||||||
blame = Blame
|
blame = Blame
|
||||||
download_file = Download file
|
download_file = Download file
|
||||||
normal_view = Normal View
|
normal_view = Normal View
|
||||||
|
@@ -15,6 +15,7 @@ import (
|
|||||||
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
git_model "code.gitea.io/gitea/models/git"
|
git_model "code.gitea.io/gitea/models/git"
|
||||||
|
issues_model "code.gitea.io/gitea/models/issues"
|
||||||
"code.gitea.io/gitea/models/renderhelper"
|
"code.gitea.io/gitea/models/renderhelper"
|
||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
unit_model "code.gitea.io/gitea/models/unit"
|
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)
|
ctx.HTML(http.StatusOK, tplCommitPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
{{if not .PageIsWiki}}
|
{{if not .PageIsWiki}}
|
||||||
<div class="branch-and-tag-area" data-text-default-branch-tooltip="{{ctx.Locale.Tr "repo.commit.contained_in_default_branch"}}">
|
<div class="branch-and-tag-area" data-text-default-branch-tooltip="{{ctx.Locale.Tr "repo.commit.contained_in_default_branch"}}">
|
||||||
|
{{if .MergedPRIssueNumber}}
|
||||||
|
{{$prLink := HTMLFormat `<a href="%s/pulls/%d">#%d</a>` $.RepoLink $.MergedPRIssueNumber $.MergedPRIssueNumber}}
|
||||||
|
<div>
|
||||||
|
<div class="divider"></div>
|
||||||
|
<div>{{ctx.Locale.Tr "repo.commit.merged_in_pr" $prLink}}</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
<button class="ui button ellipsis-button load-branches-and-tags tw-mt-2" aria-expanded="false"
|
<button class="ui button ellipsis-button load-branches-and-tags tw-mt-2" aria-expanded="false"
|
||||||
data-fetch-url="{{.RepoLink}}/commit/{{.CommitID}}/load-branches-and-tags"
|
data-fetch-url="{{.RepoLink}}/commit/{{.CommitID}}/load-branches-and-tags"
|
||||||
data-tooltip-content="{{ctx.Locale.Tr "repo.commit.load_referencing_branches_and_tags"}}"
|
data-tooltip-content="{{ctx.Locale.Tr "repo.commit.load_referencing_branches_and_tags"}}"
|
||||||
|
Reference in New Issue
Block a user