From 01156f9cc48d67e00657a788249ac02a6ed733cd Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 28 Feb 2025 00:47:00 +0800 Subject: [PATCH] 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) --- .../repo/issue/sidebar/allow_maintainer_edit.tmpl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl index ad4ce96a47..f584f9076c 100644 --- a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl +++ b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl @@ -1,13 +1,18 @@ -{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}} - {{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}} +{{- $isHeadForkedRepo := and .Issue.PullRequest .Issue.PullRequest.HeadRepo (ne .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName) -}} +{{if $isHeadForkedRepo}} + {{- $isPullPoster := and .Issue.IsPull .IsIssuePoster -}} + {{- $isPullEditable := and .Issue.PullRequest (not .Issue.IsClosed) (not .Repository.IsArchived) -}} + {{- $allowToChange := and $isPullPoster $isPullEditable -}}
-
- +
- {{end}} {{end}}