From 357397aaad853e033dcd1d7113eb54c6eab9abdf Mon Sep 17 00:00:00 2001 From: Thomas Carmet <8408330+tcarmet@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:52:17 +0000 Subject: [PATCH] PTFE-2196 authorize self bypass for admins --- bert_e/templates/not_enough_credentials.md | 4 ---- bert_e/workflow/gitwaterflow/__init__.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bert_e/templates/not_enough_credentials.md b/bert_e/templates/not_enough_credentials.md index 274a1c7d..f8e3158b 100644 --- a/bert_e/templates/not_enough_credentials.md +++ b/bert_e/templates/not_enough_credentials.md @@ -9,11 +9,7 @@ I'm afraid I cannot do that, @{{ author }}: > {{ comment|replace('\n', '\n> ') }} -{% if self_pr %} -You cannot use `{{ command }}` in your own pull request. -{% else %} You don't have enough credentials to use `{{ command }}`. -{% endif %} Please **edit** or **delete** the corresponding comment so I can move on. {% endblock %} diff --git a/bert_e/workflow/gitwaterflow/__init__.py b/bert_e/workflow/gitwaterflow/__init__.py index 5d404819..7bda9d6c 100644 --- a/bert_e/workflow/gitwaterflow/__init__.py +++ b/bert_e/workflow/gitwaterflow/__init__.py @@ -305,7 +305,7 @@ def handle_comments(job): # Look for options in all of the pull request's comments. for comment in job.pull_request.comments: author = comment.author - privileged = author in admins and author != pr_author + privileged = author in admins authored = author == pr_author text = comment.text try: @@ -318,7 +318,7 @@ def handle_comments(job): except NotPrivileged as err: raise messages.NotEnoughCredentials( active_options=job.active_options, command=err.keyword, - author=author, self_pr=(author == pr_author), comment=text + author=author, comment=text ) from err except NotAuthored as err: raise messages.NotAuthor(