Skip to content

Commit aedfc92

Browse files
authored
Improve single repo action for issue and pull requests (#20730)
Related to #20650. This will fix the behavior of the single repo action for pull requests and disables the button for other screens that don't have a single repo action currently.
1 parent 353a533 commit aedfc92

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

routers/web/user/home.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ func Pulls(ctx *context.Context) {
301301

302302
ctx.Data["Title"] = ctx.Tr("pull_requests")
303303
ctx.Data["PageIsPulls"] = true
304+
ctx.Data["SingleRepoAction"] = "pull"
304305
buildIssueOverview(ctx, unit.TypePullRequests)
305306
}
306307

@@ -314,6 +315,7 @@ func Issues(ctx *context.Context) {
314315

315316
ctx.Data["Title"] = ctx.Tr("issues")
316317
ctx.Data["PageIsIssues"] = true
318+
ctx.Data["SingleRepoAction"] = "issue"
317319
buildIssueOverview(ctx, unit.TypeIssues)
318320
}
319321

templates/user/dashboard/issues.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@
100100
</div>
101101
</div>
102102
{{if .SingleRepoLink}}
103-
<a class="ui green button" href="{{.SingleRepoLink}}/issues/new/choose">{{.locale.Tr "repo.issues.new"}}</a>
103+
{{if eq .SingleRepoAction "issue"}}
104+
<a class="ui green button" href="{{.SingleRepoLink}}/issues/new/choose">{{.locale.Tr "repo.issues.new"}}</a>
105+
{{else if eq .SingleRepoAction "pull"}}
106+
<a class="ui green button" href="{{.SingleRepoLink}}/compare">{{.locale.Tr "repo.pulls.new"}}</a>
107+
{{end}}
104108
{{end}}
105109
</div>
106110
</div>

0 commit comments

Comments
 (0)