Skip to content

Commit

Permalink
Improve single repo action for issue and pull requests (go-gitea#20730)
Browse files Browse the repository at this point in the history
Related to go-gitea#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.
  • Loading branch information
CodeDoctorDE authored and Sysoev, Vladimir committed Aug 28, 2022
1 parent bfe0931 commit 09bda24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions routers/web/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
6 changes: 5 additions & 1 deletion templates/user/dashboard/issues.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@
</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>
Expand Down

0 comments on commit 09bda24

Please sign in to comment.