Skip to content

Commit a175f98

Browse files
authored
1 parent a32cfb2 commit a175f98

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

routers/web/repo/pull.go

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
348348
}
349349

350350
if !baseGitRepo.IsBranchExist(pull.BaseBranch) {
351+
ctx.Data["BaseBranchNotExist"] = true
351352
ctx.Data["IsPullRequestBroken"] = true
352353
ctx.Data["BaseTarget"] = pull.BaseBranch
353354
ctx.Data["HeadTarget"] = pull.HeadBranch

templates/repo/issue/view_content/comments.tmpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@
231231
{{template "shared/user/avatarlink" dict "user" .Poster}}
232232
<span class="text grey muted-links">
233233
{{template "shared/user/authorlink" .Poster}}
234-
{{ctx.Locale.Tr "repo.issues.delete_branch_at" .OldRef $createdStr}}
234+
{{$oldRef := HTMLFormat `<span class="tw-line-through">%s</span>` .OldRef}}
235+
{{ctx.Locale.Tr "repo.issues.delete_branch_at" $oldRef $createdStr}}
235236
</span>
236237
</div>
237238
{{else if eq .Type 12}}

templates/repo/issue/view_title.tmpl

+6-2
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@
6161
{{if .Issue.PullRequest.IsAgitFlow}}
6262
{{$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")}}
6363
{{else}}
64-
{{$headHref = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $headHref}}
64+
{{$headHref = HTMLFormat `<span class="tw-line-through" data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $headHref}}
6565
{{end}}
6666
{{end}}
6767
{{$baseHref := .BaseTarget}}
6868
{{if .BaseBranchLink}}
69-
{{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}}
69+
{{if .BaseBranchNotExist}}
70+
{{$baseHref = HTMLFormat `<span class="tw-line-through" data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $baseHref}}
71+
{{else}}
72+
{{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}}
73+
{{end}}
7074
{{end}}
7175
{{if .Issue.PullRequest.HasMerged}}
7276
{{$mergedStr:= DateUtils.TimeSince .Issue.PullRequest.MergedUnix}}

tests/integration/pull_merge_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ func TestPullDontRetargetChildOnWrongRepo(t *testing.T) {
589589
resp := session.MakeRequest(t, req, http.StatusOK)
590590

591591
htmlDoc := NewHTMLParser(t, resp.Body)
592-
targetBranch := htmlDoc.doc.Find("#branch_target>a").Text()
592+
// the branch has been deleted, so there is no a html tag instead of span
593+
targetBranch := htmlDoc.doc.Find("#branch_target>span").Text()
593594
prStatus := strings.TrimSpace(htmlDoc.doc.Find(".issue-title-meta>.issue-state-label").Text())
594595

595596
assert.EqualValues(t, "base-pr", targetBranch)

0 commit comments

Comments
 (0)