]> source.dussan.org Git - gitea.git/commitdiff
Improve single repo action for issue and pull requests (#20730)
authorCodeDoctor <20452814+CodeDoctorDE@users.noreply.github.com>
Mon, 22 Aug 2022 12:51:48 +0000 (14:51 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Aug 2022 12:51:48 +0000 (13:51 +0100)
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.

routers/web/user/home.go
templates/user/dashboard/issues.tmpl

index f28a684054a197903f3ae32f8c1274418036fc53..c4aa749ce2ae955a618154aae7a8211691357381 100644 (file)
@@ -301,6 +301,7 @@ func Pulls(ctx *context.Context) {
 
        ctx.Data["Title"] = ctx.Tr("pull_requests")
        ctx.Data["PageIsPulls"] = true
+       ctx.Data["SingleRepoAction"] = "pull"
        buildIssueOverview(ctx, unit.TypePullRequests)
 }
 
@@ -314,6 +315,7 @@ func Issues(ctx *context.Context) {
 
        ctx.Data["Title"] = ctx.Tr("issues")
        ctx.Data["PageIsIssues"] = true
+       ctx.Data["SingleRepoAction"] = "issue"
        buildIssueOverview(ctx, unit.TypeIssues)
 }
 
index b6dc002154b67b1f94d659ee7f810ed5f3934ed5..666a7bdb2a1b1814302eedbf6494b8823f323a26 100644 (file)
                                                        </div>
                                                </div>
                                                {{if .SingleRepoLink}}
-                                                       <a class="ui green button" href="{{.SingleRepoLink}}/issues/new/choose">{{.locale.Tr "repo.issues.new"}}</a>
+                                                       {{if eq .SingleRepoAction "issue"}}
+                                                               <a class="ui green button" href="{{.SingleRepoLink}}/issues/new/choose">{{.locale.Tr "repo.issues.new"}}</a>
+                                                       {{else if eq .SingleRepoAction "pull"}}
+                                                               <a class="ui green button" href="{{.SingleRepoLink}}/compare">{{.locale.Tr "repo.pulls.new"}}</a>
+                                                       {{end}}
                                                {{end}}
                                        </div>
                                </div>