Support arbitrary reviewer strings in push options

This change alters the semantics of adding reviewers/CCs during push to
match the semantics of the Post Reviewers endpoint. The fact that they
differed is mostly an accident of history: support for adding reviewers
over push long predates reviewers-by-email or any of the other fanciness
added to Post Reviewers in the past few years.

The most significant semantic change is increasing the space of allowed
reviewers via push option:
  * By email, if the project allows it.
  * Group names.

For now at least, attempting to add a non-existing reviewer still fails,
whether due to a non-existing email when reviewers by email are not
supported, or a non-email input. The error message in this case has
changed to align with the error message from the REST API.

Due to an issue in the implementation of GroupResolver, adding groups
via push currently only works for internal groups if the group is
visible to anonymous users. This is still strictly more functionality
than before, when groups weren't supported at all, so keep the behavior
even with this known bug.

Change-Id: I24c0c27664d04f431e5b0f0c854df4a6de2ac014
This commit is contained in:
Dave Borowitz
2018-10-09 14:16:04 -07:00
parent 2c60ec21bd
commit 1531f6101a
10 changed files with 257 additions and 95 deletions

View File

@@ -319,7 +319,8 @@ public abstract class AbstractNotificationTest extends AbstractDaemonTest {
public final String ccerByEmail = "ccByEmail@example.com";
private final Map<NotifyType, TestAccount> watchers = new HashMap<>();
private final Map<String, TestAccount> accountsByEmail = new HashMap<>();
boolean supportReviewersByEmail;
public boolean supportReviewersByEmail;
private String usersCacheKey() {
return description.getClassName();