summaryrefslogtreecommitdiffstats
path: root/java/com/google/gerrit/server/mail/send/ChangeEmail.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/google/gerrit/server/mail/send/ChangeEmail.java')
-rw-r--r--java/com/google/gerrit/server/mail/send/ChangeEmail.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/java/com/google/gerrit/server/mail/send/ChangeEmail.java b/java/com/google/gerrit/server/mail/send/ChangeEmail.java
index 1a2e150e2d..5c0132caa4 100644
--- a/java/com/google/gerrit/server/mail/send/ChangeEmail.java
+++ b/java/com/google/gerrit/server/mail/send/ChangeEmail.java
@@ -408,15 +408,25 @@ public abstract class ChangeEmail extends NotificationEmail {
@Override
protected void add(RecipientType rt, Account.Id to) {
- Optional<AccountState> accountState = args.accountCache.get(to);
- if (!accountState.isPresent()) {
- return;
- }
- if (emailOnlyAttentionSetIfEnabled
- && accountState.get().generalPreferences().getEmailStrategy()
- == EmailStrategy.ATTENTION_SET_ONLY
- && !currentAttentionSet.contains(to)) {
- return;
+ addRecipient(rt, to, /* isWatcher= */ false);
+ }
+
+ /** This bypasses the EmailStrategy.ATTENTION_SET_ONLY strategy when adding the recipient. */
+ @Override
+ protected void addWatcher(RecipientType rt, Account.Id to) {
+ addRecipient(rt, to, /* isWatcher= */ true);
+ }
+
+ private void addRecipient(RecipientType rt, Account.Id to, boolean isWatcher) {
+ if (!isWatcher) {
+ Optional<AccountState> accountState = args.accountCache.get(to);
+ if (emailOnlyAttentionSetIfEnabled
+ && accountState.isPresent()
+ && accountState.get().generalPreferences().getEmailStrategy()
+ == EmailStrategy.ATTENTION_SET_ONLY
+ && !currentAttentionSet.contains(to)) {
+ return;
+ }
}
if (emailOnlyAuthors && !authors.contains(to)) {
return;