mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Hide command line merge instructions when user can't push (#17339)
Hides the command line instructions if the authenticated user can't push to the base branch. Closes #17121
This commit is contained in:
parent
554988c7b2
commit
26dfe88ff2
2 changed files with 22 additions and 18 deletions
|
@ -1543,6 +1543,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
ctx.ServerError("LoadProtectedBranch", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["ShowMergeInstructions"] = true
|
||||
if pull.ProtectedBranch != nil {
|
||||
cnt := pull.ProtectedBranch.GetGrantedApprovalsCount(pull)
|
||||
ctx.Data["IsBlockedByApprovals"] = !pull.ProtectedBranch.HasEnoughApprovals(pull)
|
||||
|
@ -1554,6 +1555,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
ctx.Data["ChangedProtectedFiles"] = pull.ChangedProtectedFiles
|
||||
ctx.Data["IsBlockedByChangedProtectedFiles"] = len(pull.ChangedProtectedFiles) != 0
|
||||
ctx.Data["ChangedProtectedFilesNum"] = len(pull.ChangedProtectedFiles)
|
||||
ctx.Data["ShowMergeInstructions"] = pull.ProtectedBranch.CanUserPush(ctx.User.ID)
|
||||
}
|
||||
ctx.Data["WillSign"] = false
|
||||
if ctx.User != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue