forked from forgejo/forgejo
[GITEA] pulls: "Edit File" button in "Files Changed" tab
Closes #1894. Gitea issue: https://github.com/go-gitea/gitea/issues/23848 (cherry picked from commit79c75164ca
) (cherry picked from commit58c76aad8f
) (cherry picked from commit5bdb3c6c53
) (cherry picked from commit94e954ce22
)
This commit is contained in:
parent
23c887f97e
commit
1388e7c7be
4 changed files with 43 additions and 8 deletions
|
@ -966,6 +966,18 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
|
|||
return
|
||||
}
|
||||
|
||||
// determine if the user viewing the pull request can edit the head branch
|
||||
if ctx.Doer != nil && pull.HeadRepo != nil && !pull.HasMerged {
|
||||
headRepoPerm, err := access_model.GetUserRepoPermission(ctx, pull.HeadRepo, ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserRepoPermission", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["HeadBranchIsEditable"] = pull.HeadRepo.CanEnableEditor() && issues_model.CanMaintainerWriteToBranch(ctx, headRepoPerm, pull.HeadBranch, ctx.Doer)
|
||||
ctx.Data["SourceRepoLink"] = pull.HeadRepo.Link()
|
||||
ctx.Data["HeadBranch"] = pull.HeadBranch
|
||||
}
|
||||
|
||||
if ctx.IsSigned && ctx.Doer != nil {
|
||||
if ctx.Data["CanMarkConversation"], err = issues_model.CanMarkConversation(ctx, issue, ctx.Doer); err != nil {
|
||||
ctx.ServerError("CanMarkConversation", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue