Fix notifications for comments on draft patch sets
Change-Id: If16e160fe78e28bb3901ddaa08de63953173f32d
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user