Add reviewers by email to REST API and Email sender
This change adds support for adding reviewers by email in PostReviewer and ChangeInfo. It also adds support for deleting reviewers using the ReviewerResource by adding Address to it. It further adds support for sending emails to reviewers that were added by email. This support includes emails for adding and removing a reviewer as well as for general change notifications. This change also adds tests and updates the documentation. Bug: Issue 4134 Change-Id: I901d711956ee69c25a05b455e068ec109821d79d
This commit is contained in:
@@ -88,6 +88,7 @@ import com.google.gerrit.server.group.SystemGroupBackend;
|
||||
import com.google.gerrit.server.index.change.ChangeIndex;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexer;
|
||||
import com.google.gerrit.server.mail.Address;
|
||||
import com.google.gerrit.server.mail.send.EmailHeader;
|
||||
import com.google.gerrit.server.notedb.ChangeNoteUtil;
|
||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||
@@ -1200,21 +1201,29 @@ public abstract class AbstractDaemonTest {
|
||||
}
|
||||
|
||||
protected void assertNotifyTo(TestAccount expected) {
|
||||
assertNotifyTo(expected.emailAddress);
|
||||
}
|
||||
|
||||
protected void assertNotifyTo(Address expected) {
|
||||
assertThat(sender.getMessages()).hasSize(1);
|
||||
Message m = sender.getMessages().get(0);
|
||||
assertThat(m.rcpt()).containsExactly(expected.emailAddress);
|
||||
assertThat(m.rcpt()).containsExactly(expected);
|
||||
assertThat(((EmailHeader.AddressList) m.headers().get("To")).getAddressList())
|
||||
.containsExactly(expected.emailAddress);
|
||||
.containsExactly(expected);
|
||||
assertThat(m.headers().get("CC").isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
protected void assertNotifyCc(TestAccount expected) {
|
||||
assertNotifyCc(expected.emailAddress);
|
||||
}
|
||||
|
||||
protected void assertNotifyCc(Address expected) {
|
||||
assertThat(sender.getMessages()).hasSize(1);
|
||||
Message m = sender.getMessages().get(0);
|
||||
assertThat(m.rcpt()).containsExactly(expected.emailAddress);
|
||||
assertThat(m.rcpt()).containsExactly(expected);
|
||||
assertThat(m.headers().get("To").isEmpty()).isTrue();
|
||||
assertThat(((EmailHeader.AddressList) m.headers().get("CC")).getAddressList())
|
||||
.containsExactly(expected.emailAddress);
|
||||
.containsExactly(expected);
|
||||
}
|
||||
|
||||
protected void assertNotifyBcc(TestAccount expected) {
|
||||
|
||||
Reference in New Issue
Block a user