mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -301,6 +301,7 @@ func Pulls(ctx *context.Context) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ctx.Data["Title"] = ctx.Tr("pull_requests")
 | 
						ctx.Data["Title"] = ctx.Tr("pull_requests")
 | 
				
			||||||
	ctx.Data["PageIsPulls"] = true
 | 
						ctx.Data["PageIsPulls"] = true
 | 
				
			||||||
 | 
						ctx.Data["SingleRepoAction"] = "pull"
 | 
				
			||||||
	buildIssueOverview(ctx, unit.TypePullRequests)
 | 
						buildIssueOverview(ctx, unit.TypePullRequests)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -314,6 +315,7 @@ func Issues(ctx *context.Context) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ctx.Data["Title"] = ctx.Tr("issues")
 | 
						ctx.Data["Title"] = ctx.Tr("issues")
 | 
				
			||||||
	ctx.Data["PageIsIssues"] = true
 | 
						ctx.Data["PageIsIssues"] = true
 | 
				
			||||||
 | 
						ctx.Data["SingleRepoAction"] = "issue"
 | 
				
			||||||
	buildIssueOverview(ctx, unit.TypeIssues)
 | 
						buildIssueOverview(ctx, unit.TypeIssues)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,7 +100,11 @@
 | 
				
			|||||||
							</div>
 | 
												</div>
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						{{if .SingleRepoLink}}
 | 
											{{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}}
 | 
											{{end}}
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user