mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Display head branch more comfortable on pull request view (#32000)
This PR do some minor improvements for head branch display on pull request view UI. - [x] Remove the link if the head branch has been deleted with a tooltip, so that users will not result in a 404 page - [x] Display a label if this pull request is an agit based one. 
This commit is contained in:
@ -164,7 +164,19 @@ func setMergeTarget(ctx *context.Context, pull *issues_model.PullRequest) {
|
||||
ctx.Data["HeadTarget"] = pull.MustHeadUserName(ctx) + "/" + pull.HeadRepo.Name + ":" + pull.HeadBranch
|
||||
}
|
||||
ctx.Data["BaseTarget"] = pull.BaseBranch
|
||||
ctx.Data["HeadBranchLink"] = pull.GetHeadBranchLink(ctx)
|
||||
headBranchLink := ""
|
||||
if pull.Flow == issues_model.PullRequestFlowGithub {
|
||||
b, err := git_model.GetBranch(ctx, ctx.Repo.Repository.ID, pull.HeadBranch)
|
||||
switch {
|
||||
case err == nil:
|
||||
if !b.IsDeleted {
|
||||
headBranchLink = pull.GetHeadBranchLink(ctx)
|
||||
}
|
||||
case !git_model.IsErrBranchNotExist(err):
|
||||
log.Error("GetBranch: %v", err)
|
||||
}
|
||||
}
|
||||
ctx.Data["HeadBranchLink"] = headBranchLink
|
||||
ctx.Data["BaseBranchLink"] = pull.GetBaseBranchLink(ctx)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user