RemoveReviewerControl: Allow to remove self from abandoned change
Bug: Issue 9419 Change-Id: I75f8570de21af508d124201cd30506606c8f3ed6
This commit is contained in:
parent
31e5ee0763
commit
fee0a2b30f
|
@ -2086,6 +2086,40 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||
gApi.changes().id(r.getChangeId()).reviewer("self").remove();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeReviewerSelfFromAbandonedChangePermitted() throws Exception {
|
||||
PushOneCommit.Result r = createChange();
|
||||
String changeId = r.getChangeId();
|
||||
|
||||
setApiUser(user);
|
||||
recommend(changeId);
|
||||
|
||||
setApiUser(admin);
|
||||
gApi.changes().id(changeId).abandon();
|
||||
|
||||
setApiUser(user);
|
||||
gApi.changes().id(r.getChangeId()).reviewer("self").remove();
|
||||
eventRecorder.assertReviewerDeletedEvents(changeId, user.email);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeOtherReviewerFromAbandonedChangeNotPermitted() throws Exception {
|
||||
PushOneCommit.Result r = createChange();
|
||||
String changeId = r.getChangeId();
|
||||
|
||||
setApiUser(user);
|
||||
recommend(changeId);
|
||||
|
||||
setApiUser(admin);
|
||||
approve(changeId);
|
||||
gApi.changes().id(changeId).abandon();
|
||||
|
||||
setApiUser(user);
|
||||
exception.expect(AuthException.class);
|
||||
exception.expectMessage("remove reviewer not permitted");
|
||||
gApi.changes().id(r.getChangeId()).reviewer(admin.getId().toString()).remove();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteVote() throws Exception {
|
||||
PushOneCommit.Result r = createChange();
|
||||
|
|
|
@ -100,7 +100,7 @@ public class RemoveReviewerControl {
|
|||
private boolean canRemoveReviewerWithoutPermissionCheck(
|
||||
Change change, CurrentUser currentUser, Account.Id reviewer, int value)
|
||||
throws NoSuchProjectException, IOException {
|
||||
if (!change.getStatus().isOpen()) {
|
||||
if (change.getStatus().equals(Change.Status.MERGED)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue