Some fixes of the prompt of new branches (#26257)
Related to #26239 This PR makes some fixes: - do not show the prompt for mirror repos and repos with pull request units disabled - use `commit_time` instead of `updated_unix`, as `commit_time` is the real time when the branch was pushed
This commit is contained in:
parent
b9baed2c74
commit
9a65d011f6
3 changed files with 15 additions and 7 deletions
|
@ -999,10 +999,18 @@ func renderCode(ctx *context.Context) {
|
|||
ctx.ServerError("GetBaseRepo", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID, ctx.Repo.Repository.DefaultBranch)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRecentlyPushedBranches", err)
|
||||
return
|
||||
|
||||
showRecentlyPushedNewBranches := true
|
||||
if ctx.Repo.Repository.IsMirror ||
|
||||
!ctx.Repo.Repository.UnitEnabled(ctx, unit_model.TypePullRequests) {
|
||||
showRecentlyPushedNewBranches = false
|
||||
}
|
||||
if showRecentlyPushedNewBranches {
|
||||
ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID, ctx.Repo.Repository.DefaultBranch)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRecentlyPushedBranches", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue