[GITEA] pulls: "Edit File" button in "Files Changed" tab
Closes #1894. Gitea issue: https://github.com/go-gitea/gitea/issues/23848 (cherry picked from commit 79c75164ca70937261b1d9a68420ebfdbdcfa4d4) (cherry picked from commit 58c76aad8f624d7701e3fa6c12264328962cdf58) (cherry picked from commit 5bdb3c6c53527da23ba76a8289ca6a81c6fcecdf) (cherry picked from commit 94e954ce2248f14082f0c3071cc076c118c4a791) (cherry picked from commit 1388e7c7bef7a34018b993c24b34e053849eb93a) (cherry picked from commit 6a234abff532bfc8806e0cccf8c2d1d8c3e90c24)
This commit is contained in:
parent
5c0894a588
commit
f3b298133e
4 changed files with 43 additions and 8 deletions
|
@ -967,6 +967,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