diff options
author | Saša Živkov <zivkov@gmail.com> | 2014-12-11 16:04:20 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-12-11 16:04:21 +0000 |
commit | 6a183693a545dd70356dc9038fa5f7ed038ffcef (patch) | |
tree | 5edb949b756533c6aa736f40434eedf105c4a351 | |
parent | 36d6f2659862494751cdd46a7ee6b06c4ae3d84e (diff) | |
parent | 202f02835a0315357b57b02aab6011ddb708dbac (diff) |
Merge "Do not include project watchers on new draft changes" into stable-2.10
-rw-r--r-- | gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java | 42 |
1 files changed, 22 insertions, 20 deletions
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) { |