Merge "Fix notifications for comments on draft patch sets"

This commit is contained in:
ekempin
2017-04-27 06:55:32 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 3 deletions

View File

@@ -100,7 +100,7 @@ public class ProjectWatchIT extends AbstractDaemonTest {
nc.addEmail(addr);
nc.setName("team");
nc.setHeader(NotifyConfig.Header.TO);
nc.setTypes(EnumSet.of(NotifyType.NEW_CHANGES));
nc.setTypes(EnumSet.of(NotifyType.NEW_CHANGES, NotifyType.ALL_COMMENTS));
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
cfg.putNotifyConfig("team", nc);
@@ -113,6 +113,13 @@ public class ProjectWatchIT extends AbstractDaemonTest {
r.assertOkStatus();
assertThat(sender.getMessages()).isEmpty();
setApiUser(admin);
ReviewInput in = new ReviewInput();
in.message = "comment";
gApi.changes().id(r.getChangeId()).current().review(in);
assertThat(sender.getMessages()).isEmpty();
}
@Test
@@ -122,7 +129,7 @@ public class ProjectWatchIT extends AbstractDaemonTest {
nc.addEmail(addr);
nc.setName("team");
nc.setHeader(NotifyConfig.Header.TO);
nc.setTypes(EnumSet.of(NotifyType.NEW_PATCHSETS));
nc.setTypes(EnumSet.of(NotifyType.NEW_PATCHSETS, NotifyType.ALL_COMMENTS));
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
cfg.putNotifyConfig("team", nc);
@@ -143,6 +150,13 @@ public class ProjectWatchIT extends AbstractDaemonTest {
r.assertOkStatus();
assertThat(sender.getMessages()).isEmpty();
setApiUser(admin);
ReviewInput in = new ReviewInput();
in.message = "comment";
gApi.changes().id(r.getChangeId()).current().review(in);
assertThat(sender.getMessages()).isEmpty();
}
@Test

View File

@@ -155,7 +155,7 @@ public class CommentSender extends ReplyToChangeSender {
}
if (notify.compareTo(NotifyHandling.ALL) >= 0) {
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS);
includeWatchers(NotifyType.ALL_COMMENTS, !patchSet.isDraft());
}
removeUsersThatIgnoredTheChange();