mirror of
https://github.com/go-gitea/gitea
synced 2024-11-22 02:34:43 +01:00
Add line-through for deleted branch on pull request view page
This commit is contained in:
parent
ad223000d4
commit
7ce388f740
2 changed files with 13 additions and 2 deletions
|
@ -348,6 +348,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
|
||||||
}
|
}
|
||||||
|
|
||||||
if !baseGitRepo.IsBranchExist(pull.BaseBranch) {
|
if !baseGitRepo.IsBranchExist(pull.BaseBranch) {
|
||||||
|
ctx.Data["BaseBranchNotExist"] = true
|
||||||
ctx.Data["IsPullRequestBroken"] = true
|
ctx.Data["IsPullRequestBroken"] = true
|
||||||
ctx.Data["BaseTarget"] = pull.BaseBranch
|
ctx.Data["BaseTarget"] = pull.BaseBranch
|
||||||
ctx.Data["HeadTarget"] = pull.HeadBranch
|
ctx.Data["HeadTarget"] = pull.HeadBranch
|
||||||
|
@ -431,6 +432,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
|
||||||
ctx.Data["GetCommitMessages"] = pull_service.GetSquashMergeCommitMessages(ctx, pull)
|
ctx.Data["GetCommitMessages"] = pull_service.GetSquashMergeCommitMessages(ctx, pull)
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["GetCommitMessages"] = ""
|
ctx.Data["GetCommitMessages"] = ""
|
||||||
|
ctx.Data["HeadBranchNotExist"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
sha, err := baseGitRepo.GetRefCommitID(pull.GetGitRefName())
|
sha, err := baseGitRepo.GetRefCommitID(pull.GetGitRefName())
|
||||||
|
|
|
@ -56,7 +56,11 @@
|
||||||
{{if .Issue.IsPull}}
|
{{if .Issue.IsPull}}
|
||||||
{{$headHref := .HeadTarget}}
|
{{$headHref := .HeadTarget}}
|
||||||
{{if .HeadBranchLink}}
|
{{if .HeadBranchLink}}
|
||||||
{{$headHref = HTMLFormat `<a href="%s">%s</a> <button class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` .HeadBranchLink $headHref (ctx.Locale.Tr "copy_branch") .HeadTarget (svg "octicon-copy" 14)}}
|
{{if .HeadBranchNotExist}}
|
||||||
|
{{$headHref = HTMLFormat `<span class="tw-line-through" data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $headHref}}
|
||||||
|
{{else}}
|
||||||
|
{{$headHref = HTMLFormat `<a href="%s">%s</a> <button class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` .HeadBranchLink $headHref (ctx.Locale.Tr "copy_branch") .HeadTarget (svg "octicon-copy" 14)}}
|
||||||
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if .Issue.PullRequest.IsAgitFlow}}
|
{{if .Issue.PullRequest.IsAgitFlow}}
|
||||||
{{$headHref = HTMLFormat `%s <a href="%s" target="_blank"><span class="ui label basic tiny" data-tooltip-content="%s">AGit</span></a>` $headHref "https://docs.gitea.com/usage/agit" (ctx.Locale.Tr "repo.pull.agit_documentation")}}
|
{{$headHref = HTMLFormat `%s <a href="%s" target="_blank"><span class="ui label basic tiny" data-tooltip-content="%s">AGit</span></a>` $headHref "https://docs.gitea.com/usage/agit" (ctx.Locale.Tr "repo.pull.agit_documentation")}}
|
||||||
|
@ -66,8 +70,13 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
{{$baseHref := .BaseTarget}}
|
{{$baseHref := .BaseTarget}}
|
||||||
{{if .BaseBranchLink}}
|
{{if .BaseBranchLink}}
|
||||||
{{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}}
|
{{if .BaseBranchNotExist}}
|
||||||
|
{{$baseHref = HTMLFormat `<span class="tw-line-through" data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $baseHref}}
|
||||||
|
{{else}}
|
||||||
|
{{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}}
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .Issue.PullRequest.HasMerged}}
|
{{if .Issue.PullRequest.HasMerged}}
|
||||||
{{$mergedStr:= DateUtils.TimeSince .Issue.PullRequest.MergedUnix}}
|
{{$mergedStr:= DateUtils.TimeSince .Issue.PullRequest.MergedUnix}}
|
||||||
{{if .Issue.OriginalAuthor}}
|
{{if .Issue.OriginalAuthor}}
|
||||||
|
|
Loading…
Reference in a new issue