New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine to let them increase it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It's the case of an author reducing it after a Reviewer has increased it that I think should be disallowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinrushforth and @prrace - I agree, see changes in commit 347594f
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed in 7b17768
|
||
CommandInvocation(String id, HostUser user, CommandHandler handler, String name, String args) { | ||
CommandInvocation(String id, HostUser user, CommandHandler handler, String name, String args, Comment comment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think you can drop this parameter if you drop the exclude param!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed in 7b17768
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())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@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