Skip to content

Commit 01156f9

Browse files
authored
Show info about maintainers are allowed to edit a PR (#33738)
A simple and clear approach. The existing test TestPullCompare_EnableAllowEditsFromMaintainer should be good enough. Fix #21280 ![image](https://github.com/user-attachments/assets/b685950b-4095-45ad-b913-425f840f2876)
1 parent 8db8a3b commit 01156f9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}}
2-
{{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}}
1+
{{- $isHeadForkedRepo := and .Issue.PullRequest .Issue.PullRequest.HeadRepo (ne .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName) -}}
2+
{{if $isHeadForkedRepo}}
3+
{{- $isPullPoster := and .Issue.IsPull .IsIssuePoster -}}
4+
{{- $isPullEditable := and .Issue.PullRequest (not .Issue.IsClosed) (not .Repository.IsArchived) -}}
5+
{{- $allowToChange := and $isPullPoster $isPullEditable -}}
36
<div class="divider"></div>
4-
<div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers"
7+
<div class="ui checkbox {{if not $allowToChange}}disabled{{end}} loading-icon-2px"
8+
{{if $allowToChange}}
9+
id="allow-edits-from-maintainers"
510
data-url="{{.Issue.Link}}"
611
data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"
712
data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}"
13+
{{end}}
814
>
915
<label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label>
10-
<input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}>
16+
<input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}} {{if not $allowToChange}}disabled{{end}}>
1117
</div>
12-
{{end}}
1318
{{end}}

0 commit comments

Comments
 (0)