673: PR author should be able to use /reviewers command #820
Conversation
|
@edvbld The following label will be automatically applied to this pull request: When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing list. If you would like to change these labels, use the |
Webrevs
|
I presume that the author cannot reduce the number of reviewers once it has been increased, unless they are also a "R"eviewer? |
@@ -49,8 +49,8 @@ private void showHelp(PrintWriter reply) { | |||
|
|||
@Override | |||
public void handle(PullRequestBot bot, PullRequest pr, CensusInstance censusInstance, Path scratchPath, CommandInvocation command, List<Comment> allComments, PrintWriter reply) { | |||
if (!censusInstance.isReviewer(command.user())) { | |||
reply.println("Only [Reviewers](https://openjdk.java.net/bylaws#reviewer) are allowed to change the number of required reviewers."); | |||
if (!pr.author().equals(command.user()) && !censusInstance.isReviewer(command.user())) { |
kevinrushforth
Sep 14, 2020
Member
This would suggest that my assumption is wrong, and that an author can reduce the number of reviewers required even if they are not a Reviewer. I think this might not be what we want.
This would suggest that my assumption is wrong, and that an author can reduce the number of reviewers required even if they are not a Reviewer. I think this might not be what we want.
prrace
Sep 14, 2020
I think it is fine to let them increase it.
I think it is fine to let them increase it.
kevinrushforth
Sep 14, 2020
Member
Agreed. It's the case of an author reducing it after a Reviewer has increased it that I think should be disallowed.
Agreed. It's the case of an author reducing it after a Reviewer has increased it that I think should be disallowed.
Looks good, but you can probably simplify it a bit since the "exclude" parameter isn't really used. :) |
return additionalRequiredReviewers(botUser, comments, null); | ||
} | ||
|
||
static Optional<AdditionalRequiredReviewers> additionalRequiredReviewers(HostUser botUser, List<Comment> comments, Comment exclude) { |
rwestberg
Sep 15, 2020
Member
The exclude comment parameter probably isn't the one you are looking for, as the reply marker isn't in the command comment but the reply.
The exclude comment parameter probably isn't the one you are looking for, as the reply marker isn't in the command comment but the reply.
|
||
CommandInvocation(String id, HostUser user, CommandHandler handler, String name, String args) { | ||
CommandInvocation(String id, HostUser user, CommandHandler handler, String name, String args, Comment comment) { |
rwestberg
Sep 15, 2020
Member
Think you can drop this parameter if you drop the exclude param!
Think you can drop this parameter if you drop the exclude param!
Looks good with one minor suggestion (feel free to ignore it). |
@@ -83,6 +108,21 @@ public void handle(PullRequestBot bot, PullRequest pr, CensusInstance censusInst | |||
role = roleMappings.get(splitArgs[1].toLowerCase()); | |||
} | |||
|
|||
if (pr.author().equals(command.user()) && !censusInstance.isReviewer(command.user())) { |
kevinrushforth
Sep 15, 2020
Member
Maybe simplify this to just ! isReviewer
? Including the test for is author
doesn't really add value (removing it seems to better reflect the intent and might be safer / more future proof).
Maybe simplify this to just ! isReviewer
? Including the test for is author
doesn't really add value (removing it seems to better reflect the intent and might be safer / more future proof).
edvbld
Sep 15, 2020
•
Author
Member
No, we don't want people who are not the PR author and who are not Reviewers to be able to increase the required number of reviewers. Allowing that makes it possible to harass pull request by e.g. registering a spam account and just drop a bunch /reviewers 9
in a number of PRs.
No, we don't want people who are not the PR author and who are not Reviewers to be able to increase the required number of reviewers. Allowing that makes it possible to harass pull request by e.g. registering a spam account and just drop a bunch /reviewers 9
in a number of PRs.
kevinrushforth
Sep 15, 2020
Member
I agree, but that isn't related to this block (your concern is a good one and is handled by the previous block). By adding the author &&
to !reviewer
it makes this less restrictive not more. In any case, it doesn't matter...at least not given the prior test.
I agree, but that isn't related to this block (your concern is a good one and is handled by the previous block). By adding the author &&
to !reviewer
it makes this less restrictive not more. In any case, it doesn't matter...at least not given the prior test.
Looks good! |
@edvbld This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements After integration, the commit message will be:
Since the source branch of this PR was last updated there have been 2 commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge
|
/integrate |
@edvbld Since your change was applied there have been 2 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 82aa583. |
Hi all,
please review this patch that allows pull request author's to issue the
/reviewers
command (sometimes the PR author knows ahead of time that it is a complicated to PR to review).Testing:
make test
passes on Linux x64Thanks,
Erik
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/skara pull/820/head:pull/820
$ git checkout pull/820