1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-28 05:08:37 +00:00

Also display "recently pushed branch" alert on PR view (#35001)

This commit adds the "You recently pushed to branch X" alert also to PR
overview, as opposed to only the repository's home page.

GitHub also shows this alert on the PR list, as well as the home page.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
Naxdy
2025-07-10 19:17:56 +02:00
committed by GitHub
parent f35dcfd489
commit 32152a0ac0
9 changed files with 100 additions and 60 deletions

View File

@@ -1,12 +1,18 @@
{{range .RecentlyPushedNewBranches}}
<div class="ui positive message tw-flex tw-items-center tw-gap-2">
<div class="tw-flex-1 tw-break-anywhere">
{{$timeSince := DateUtils.TimeSince .CommitTime}}
{{$branchLink := HTMLFormat `<a href="%s">%s</a>` .BranchLink .BranchDisplayName}}
{{/* Template Attributes:
* RecentBranchesPromptData
*/}}
{{$data := .RecentBranchesPromptData}}
{{if $data}}
{{range $recentBranch := $data.RecentlyPushedNewBranches}}
<div class="ui positive message flex-text-block">
<div class="tw-flex-1">
{{$timeSince := DateUtils.TimeSince $recentBranch.CommitTime}}
{{$branchLink := HTMLFormat `<a href="%s">%s</a>` $recentBranch.BranchLink .BranchDisplayName}}
{{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $branchLink $timeSince}}
</div>
<a role="button" class="ui compact green button tw-m-0" href="{{QueryBuild .BranchCompareURL "expand" 1}}">
<a role="button" class="ui compact green button" href="{{QueryBuild $recentBranch.BranchCompareURL "expand" 1}}">
{{ctx.Locale.Tr "repo.pulls.compare_changes"}}
</a>
</div>
{{end}}
{{end}}

View File

@@ -15,7 +15,7 @@
</div>
{{end}}
{{template "repo/code/recently_pushed_new_branches" .}}
{{template "repo/code/recently_pushed_new_branches" dict "RecentBranchesPromptData" .RecentBranchesPromptData}}
<div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" "repo-grid-filelist-only"}}">
<div class="repo-home-filelist">

View File

@@ -4,6 +4,8 @@
<div class="ui container">
{{template "base/alert" .}}
{{template "repo/code/recently_pushed_new_branches" dict "RecentBranchesPromptData" .RecentBranchesPromptData}}
{{if .PinnedIssues}}
<div id="issue-pins" {{if .IsRepoAdmin}}data-is-repo-admin{{end}}>
{{range .PinnedIssues}}

View File

@@ -14,7 +14,7 @@
</div>
{{end}}
{{template "repo/code/recently_pushed_new_branches" .}}
{{template "repo/code/recently_pushed_new_branches" dict "RecentBranchesPromptData" .RecentBranchesPromptData}}
<div class="repo-view-container">
<div class="tw-flex tw-flex-col repo-view-file-tree-container not-mobile {{if not .UserSettingCodeViewShowFileTree}}tw-hidden{{end}}" {{if .IsSigned}}data-user-is-signed-in{{end}}>