Send email notifications and fire Gerrit event if comments are posted via email
Change-Id: I4121b8d8b13f9a675fc227a81f6543501b3084f6
This commit is contained in:
@@ -208,6 +208,35 @@ public class MailProcessorIT extends AbstractDaemonTest {
|
||||
gApi.accounts().id("user").setActive(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sendNotificationAfterPersistingComments() throws Exception {
|
||||
String changeId = createChangeWithReview();
|
||||
ChangeInfo changeInfo = gApi.changes().id(changeId).get();
|
||||
List<CommentInfo> comments = gApi.changes().id(changeId).current().commentsAsList();
|
||||
assertThat(comments).hasSize(2);
|
||||
String ts =
|
||||
MailUtil.rfcDateformatter.format(
|
||||
ZonedDateTime.ofInstant(comments.get(0).updated.toInstant(), ZoneId.of("UTC")));
|
||||
|
||||
// Build Message
|
||||
String txt =
|
||||
newPlaintextBody(
|
||||
canonicalWebUrl.get() + "#/c/" + changeInfo._number + "/1",
|
||||
"Test Message",
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
MailMessage.Builder b =
|
||||
messageBuilderWithDefaultFields()
|
||||
.from(user.emailAddress)
|
||||
.textContent(txt + textFooterForChange(changeId, ts));
|
||||
|
||||
sender.clear();
|
||||
mailProcessor.process(b.build());
|
||||
|
||||
assertNotifyTo(admin);
|
||||
}
|
||||
|
||||
private static CommentInput newComment(String path, Side side, int line, String message) {
|
||||
CommentInput c = new CommentInput();
|
||||
c.path = path;
|
||||
|
||||
Reference in New Issue
Block a user