mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	* Revert #5877 This unfortunately was not the solution. Signed-off-by: Andrew Thornton <art27@cantab.net> * Change permission check to create pull requests to CanReadIssuesOrPulls Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -668,8 +668,8 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
 | 
				
			|||||||
		ctx.ServerError("GetUserRepoPermission", err)
 | 
							ctx.ServerError("GetUserRepoPermission", err)
 | 
				
			||||||
		return nil, nil, nil, nil, "", ""
 | 
							return nil, nil, nil, nil, "", ""
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !perm.CanWrite(models.UnitTypeCode) {
 | 
						if !perm.CanReadIssuesOrPulls(true) {
 | 
				
			||||||
		log.Trace("ParseCompareInfo[%d]: does not have write access or site admin", baseRepo.ID)
 | 
							log.Trace("ParseCompareInfo[%d]: cannot create/read pull requests", baseRepo.ID)
 | 
				
			||||||
		ctx.Status(404)
 | 
							ctx.Status(404)
 | 
				
			||||||
		return nil, nil, nil, nil, "", ""
 | 
							return nil, nil, nil, nil, "", ""
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -684,8 +684,8 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
 | 
				
			|||||||
		ctx.ServerError("GetUserRepoPermission", err)
 | 
							ctx.ServerError("GetUserRepoPermission", err)
 | 
				
			||||||
		return nil, nil, nil, nil, "", ""
 | 
							return nil, nil, nil, nil, "", ""
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !perm.CanWrite(models.UnitTypeCode) {
 | 
						if !perm.CanReadIssuesOrPulls(true) {
 | 
				
			||||||
		log.Trace("ParseCompareInfo[%d]: does not have write access or site admin", baseRepo.ID)
 | 
							log.Trace("ParseCompareInfo[%d]: cannot create/read pull requests", baseRepo.ID)
 | 
				
			||||||
		ctx.NotFound("ParseCompareInfo", nil)
 | 
							ctx.NotFound("ParseCompareInfo", nil)
 | 
				
			||||||
		return nil, nil, nil, nil, "", ""
 | 
							return nil, nil, nil, nil, "", ""
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,7 +54,7 @@
 | 
				
			|||||||
		<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
 | 
							<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
 | 
				
			||||||
			{{if and .PullRequestCtx.Allowed .IsViewBranch}}
 | 
								{{if and .PullRequestCtx.Allowed .IsViewBranch}}
 | 
				
			||||||
				<div class="fitted item">
 | 
									<div class="fitted item">
 | 
				
			||||||
					<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{ if .Repository.IsFork }}{{.Repository.Owner.Name}}{{ else }}{{ .SignedUserName }}{{ end }}:{{.BranchName | EscapePound}}">
 | 
										<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}">
 | 
				
			||||||
					<button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
 | 
										<button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
 | 
				
			||||||
					</a>
 | 
										</a>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user