From de528d3f91eed8d818a98cd028aefba162219439 Mon Sep 17 00:00:00 2001 From: Patrick Hiesel Date: Thu, 9 Mar 2017 09:24:13 +0100 Subject: [PATCH] Split PLAINTEXT and HTML recipients regardless of fromId Change-Id: I11b4b926f53e1e5be67193d2d9a90a6d7bd085e6 --- .../server/mail/send/OutgoingEmail.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/send/OutgoingEmail.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/send/OutgoingEmail.java index 2b90306dbf..730b71000d 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/send/OutgoingEmail.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/send/OutgoingEmail.java @@ -147,23 +147,22 @@ public abstract class OutgoingEmail { // removeUser(fromUser); } - - // Check the preferences of all recipients. If any user has disabled - // his email notifications then drop him from recipients' list. - // In addition, check if users only want to receive plaintext email. - for (Account.Id id : rcptTo) { - Account thisUser = args.accountCache.get(id).getAccount(); - GeneralPreferencesInfo prefs = thisUser.getGeneralPreferencesInfo(); - if (prefs == null || prefs.getEmailStrategy() == DISABLED) { - removeUser(thisUser); - } else if (useHtml() && prefs.getEmailFormat() == EmailFormat.PLAINTEXT) { - removeUser(thisUser); - smtpRcptToPlaintextOnly.add( - new Address(thisUser.getFullName(), thisUser.getPreferredEmail())); - } - if (smtpRcptTo.isEmpty() && smtpRcptToPlaintextOnly.isEmpty()) { - return; - } + } + // Check the preferences of all recipients. If any user has disabled + // his email notifications then drop him from recipients' list. + // In addition, check if users only want to receive plaintext email. + for (Account.Id id : rcptTo) { + Account thisUser = args.accountCache.get(id).getAccount(); + GeneralPreferencesInfo prefs = thisUser.getGeneralPreferencesInfo(); + if (prefs == null || prefs.getEmailStrategy() == DISABLED) { + removeUser(thisUser); + } else if (useHtml() && prefs.getEmailFormat() == EmailFormat.PLAINTEXT) { + removeUser(thisUser); + smtpRcptToPlaintextOnly.add( + new Address(thisUser.getFullName(), thisUser.getPreferredEmail())); + } + if (smtpRcptTo.isEmpty() && smtpRcptToPlaintextOnly.isEmpty()) { + return; } }