[CHG] runbot_merge: allow pr author to approve all fw

- trigger FW section on all forward ports, not just attached ones
- allow author of original PR to approve any fwport
This commit is contained in:
Xavier Morel 2024-06-10 15:17:11 +02:00
parent e403593799
commit 187f7f6429

View File

@ -665,7 +665,7 @@ class PullRequests(models.Model):
match command:
case commands.Approve() if self.draft:
msg = "draft PRs can not be approved."
case commands.Approve() if self.parent_id:
case commands.Approve() if self.source_id:
# rules are a touch different for forwardport PRs:
valid = lambda _: True if command.ids is None else lambda n: n in command.ids
_, source_reviewer, source_author = self.source_id._pr_acl(author)
@ -674,6 +674,10 @@ class PullRequests(models.Model):
# - reviewers on the original can approve any forward port
if source_reviewer:
approveable = ancestors
elif source_author:
# give full review rights on all forwardports (attached
# or not) to original author
approveable = ancestors
else:
# between the first merged ancestor and self
mergeors = list(itertools.dropwhile(