Merge "Add config to remove emails for new patchsets"

This commit is contained in:
Gal Paikin
2020-08-26 15:25:58 +00:00
committed by Gerrit Code Review
5 changed files with 62 additions and 5 deletions

View File

@@ -1387,6 +1387,7 @@ public abstract class AbstractDaemonTest {
pwi.filter = filter;
pwi.notifyAbandonedChanges = true;
pwi.notifyNewChanges = true;
pwi.notifyNewPatchSets = true;
pwi.notifyAllComments = true;
});
}

View File

@@ -37,6 +37,7 @@ public class EmailSettings {
public final String password;
public final Encryption encryption;
public final long fetchInterval; // in milliseconds
public final boolean sendNewPatchsetEmails;
@Inject
EmailSettings(@GerritServerConfig Config cfg) {
@@ -58,5 +59,6 @@ public class EmailSettings {
"fetchInterval",
TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS),
TimeUnit.MILLISECONDS);
sendNewPatchsetEmails = cfg.getBoolean("change", null, "sendNewPatchsetEmails", true);
}
}

View File

@@ -61,12 +61,14 @@ public class ReplacePatchSetSender extends ReplyToChangeSender {
//
reviewers.remove(fromId);
}
if (notify.handling() == NotifyHandling.ALL
|| notify.handling() == NotifyHandling.OWNER_REVIEWERS) {
add(RecipientType.TO, reviewers);
add(RecipientType.CC, extraCC);
if (args.settings.sendNewPatchsetEmails) {
if (notify.handling() == NotifyHandling.ALL
|| notify.handling() == NotifyHandling.OWNER_REVIEWERS) {
add(RecipientType.TO, reviewers);
add(RecipientType.CC, extraCC);
}
rcptToAuthors(RecipientType.CC);
}
rcptToAuthors(RecipientType.CC);
bccStarredBy();
includeWatchers(NotifyType.NEW_PATCHSETS, !change.isWorkInProgress() && !change.isPrivate());
removeUsersThatIgnoredTheChange();