diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-07-08 05:19:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-08 05:19:00 +0200 |
commit | 6375419468edc95fdfac94aac3b0e10b23743557 (patch) | |
tree | e104617051a314fa33e62ebcf7c149d0d0434b82 /routers | |
parent | Translate untranslated string in issues list (#25759) (diff) | |
download | forgejo-6375419468edc95fdfac94aac3b0e10b23743557.tar.xz forgejo-6375419468edc95fdfac94aac3b0e10b23743557.zip |
Newly pushed branches hints on repository home page (#25715)
This PR will display a pull request creation hint on the repository home
page when there are newly created branches with no pull request. Only
the recent 6 hours and 2 updated branches will be displayed.
Inspired by #14003
Replace #14003
Resolves #311
Resolves #13196
Resolves #23743
co-authored by @kolaente
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/view.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index ad87bae9b8..acea08d629 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -977,6 +977,18 @@ func renderCode(ctx *context.Context) { return } + if ctx.Doer != nil { + if err := ctx.Repo.Repository.GetBaseRepo(ctx); err != nil { + ctx.ServerError("GetBaseRepo", err) + return + } + ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID) + if err != nil { + ctx.ServerError("GetRecentlyPushedBranches", err) + return + } + } + var treeNames []string paths := make([]string, 0, 5) if len(ctx.Repo.TreePath) > 0 { |