diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java index 3c9f39c01e..f570ac8253 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java @@ -45,30 +45,32 @@ public class CreateChangeSender extends NewChangeSender { protected void init() throws EmailException { super.init(); - try { - // Try to mark interested owners with TO and CC or BCC line. - Watchers matching = getWatchers(NotifyType.NEW_CHANGES); - for (Account.Id user : Iterables.concat( - matching.to.accounts, - matching.cc.accounts, - matching.bcc.accounts)) { - if (isOwnerOfProjectOrBranch(user)) { - add(RecipientType.TO, user); + if (change.getStatus() == Change.Status.NEW) { + try { + // Try to mark interested owners with TO and CC or BCC line. + Watchers matching = getWatchers(NotifyType.NEW_CHANGES); + for (Account.Id user : Iterables.concat( + matching.to.accounts, + matching.cc.accounts, + matching.bcc.accounts)) { + if (isOwnerOfProjectOrBranch(user)) { + add(RecipientType.TO, user); + } } + + // Add everyone else. Owners added above will not be duplicated. + add(RecipientType.TO, matching.to); + add(RecipientType.CC, matching.cc); + add(RecipientType.BCC, matching.bcc); + } catch (OrmException err) { + // Just don't CC everyone. Better to send a partial message to those + // we already have queued up then to fail deliver entirely to people + // who have a lower interest in the change. + log.warn("Cannot notify watchers for new change", err); } - // Add everyone else. Owners added above will not be duplicated. - add(RecipientType.TO, matching.to); - add(RecipientType.CC, matching.cc); - add(RecipientType.BCC, matching.bcc); - } catch (OrmException err) { - // Just don't CC everyone. Better to send a partial message to those - // we already have queued up then to fail deliver entirely to people - // who have a lower interest in the change. - log.warn("Cannot notify watchers for new change", err); + includeWatchers(NotifyType.NEW_PATCHSETS); } - - includeWatchers(NotifyType.NEW_PATCHSETS); } private boolean isOwnerOfProjectOrBranch(Account.Id user) {