Merge "Do not await async ChangeIndex updates in Batch Update, subject to experiment"
diff --git a/java/com/google/gerrit/server/change/DeleteReviewerOp.java b/java/com/google/gerrit/server/change/DeleteReviewerOp.java
index afb9d76..fc07592 100644
--- a/java/com/google/gerrit/server/change/DeleteReviewerOp.java
+++ b/java/com/google/gerrit/server/change/DeleteReviewerOp.java
@@ -187,7 +187,7 @@
if (input.notify == null
&& currChange.isWorkInProgress()
&& !oldApprovals.isEmpty()
- && notify.handling().compareTo(NotifyHandling.OWNER) < 0) {
+ && notify.handling().equals(NotifyHandling.NONE)) {
// Override NotifyHandling from the context to notify owner if votes were removed on a WIP
// change.
notify = notify.withHandling(NotifyHandling.OWNER);
diff --git a/java/com/google/gerrit/server/change/NotifyResolver.java b/java/com/google/gerrit/server/change/NotifyResolver.java
index 27951ca..ff87bff 100644
--- a/java/com/google/gerrit/server/change/NotifyResolver.java
+++ b/java/com/google/gerrit/server/change/NotifyResolver.java
@@ -66,7 +66,7 @@
}
public boolean shouldNotify() {
- return !accounts().isEmpty() || handling().compareTo(NotifyHandling.NONE) > 0;
+ return !accounts().isEmpty() || !handling().equals(NotifyHandling.NONE);
}
}
diff --git a/java/com/google/gerrit/server/change/PatchSetInserter.java b/java/com/google/gerrit/server/change/PatchSetInserter.java
index cff3de2..4a09f84 100644
--- a/java/com/google/gerrit/server/change/PatchSetInserter.java
+++ b/java/com/google/gerrit/server/change/PatchSetInserter.java
@@ -287,7 +287,7 @@
psUtil.insert(
ctx.getRevWalk(), ctx.getUpdate(psId), psId, commitId, newGroups, null, description);
- if (ctx.getNotify(change.getId()).handling() != NotifyHandling.NONE) {
+ if (!ctx.getNotify(change.getId()).handling().equals(NotifyHandling.NONE)) {
oldReviewers = approvalsUtil.getReviewers(ctx.getNotes());
}
diff --git a/java/com/google/gerrit/server/change/WorkInProgressOp.java b/java/com/google/gerrit/server/change/WorkInProgressOp.java
index 04fd1c0..a0bf5b4 100644
--- a/java/com/google/gerrit/server/change/WorkInProgressOp.java
+++ b/java/com/google/gerrit/server/change/WorkInProgressOp.java
@@ -124,7 +124,8 @@
stateChanged.fire(ctx.getChangeData(change), ps, ctx.getAccount(), ctx.getWhen());
NotifyResolver.Result notify = ctx.getNotify(change.getId());
if (workInProgress
- || notify.handling().compareTo(NotifyHandling.OWNER_REVIEWERS) < 0
+ || notify.handling().equals(NotifyHandling.OWNER)
+ || notify.handling().equals(NotifyHandling.NONE)
|| !sendEmail) {
return;
}
diff --git a/java/com/google/gerrit/server/mail/send/ChangeEmail.java b/java/com/google/gerrit/server/mail/send/ChangeEmail.java
index ff811a0..996b8f0 100644
--- a/java/com/google/gerrit/server/mail/send/ChangeEmail.java
+++ b/java/com/google/gerrit/server/mail/send/ChangeEmail.java
@@ -211,7 +211,8 @@
setChangeUrlHeader();
setCommitIdHeader();
- if (notify.handling().compareTo(NotifyHandling.OWNER_REVIEWERS) >= 0) {
+ if (notify.handling().equals(NotifyHandling.OWNER_REVIEWERS)
+ || notify.handling().equals(NotifyHandling.ALL)) {
try {
addByEmail(
RecipientType.CC, changeData.reviewersByEmail().byState(ReviewerStateInternal.CC));
diff --git a/java/com/google/gerrit/server/mail/send/CommentSender.java b/java/com/google/gerrit/server/mail/send/CommentSender.java
index 79696fe..3711ca2 100644
--- a/java/com/google/gerrit/server/mail/send/CommentSender.java
+++ b/java/com/google/gerrit/server/mail/send/CommentSender.java
@@ -172,10 +172,11 @@
protected void init() throws EmailException {
super.init();
- if (notify.handling().compareTo(NotifyHandling.OWNER_REVIEWERS) >= 0) {
+ if (notify.handling().equals(NotifyHandling.OWNER_REVIEWERS)
+ || notify.handling().equals(NotifyHandling.ALL)) {
ccAllApprovals();
}
- if (notify.handling().compareTo(NotifyHandling.ALL) >= 0) {
+ if (notify.handling().equals(NotifyHandling.ALL)) {
bccStarredBy();
includeWatchers(NotifyType.ALL_COMMENTS, !change.isWorkInProgress() && !change.isPrivate());
}
diff --git a/java/com/google/gerrit/server/mail/send/MergedSender.java b/java/com/google/gerrit/server/mail/send/MergedSender.java
index 9717f0e..44b6efa 100644
--- a/java/com/google/gerrit/server/mail/send/MergedSender.java
+++ b/java/com/google/gerrit/server/mail/send/MergedSender.java
@@ -62,7 +62,7 @@
public void setNotify(NotifyResolver.Result notify) {
checkNotNull(notify);
if (!stickyApprovalDiff.isEmpty()) {
- if (notify.handling() != NotifyHandling.ALL) {
+ if (!notify.handling().equals(NotifyHandling.ALL)) {
logger.atFine().log(
"Requested to notify %s, but for change submission with sticky approval diff,"
+ " Notify=ALL is enforced.",
diff --git a/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java b/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java
index 5f31c68..1e53288 100644
--- a/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java
+++ b/java/com/google/gerrit/server/mail/send/ReplacePatchSetSender.java
@@ -123,8 +123,8 @@
reviewers.remove(fromId);
}
if (args.settings.sendNewPatchsetEmails) {
- if (notify.handling() == NotifyHandling.ALL
- || notify.handling() == NotifyHandling.OWNER_REVIEWERS) {
+ if (notify.handling().equals(NotifyHandling.ALL)
+ || notify.handling().equals(NotifyHandling.OWNER_REVIEWERS)) {
reviewers.stream().forEach(r -> add(RecipientType.TO, r));
extraCC.stream().forEach(cc -> add(RecipientType.CC, cc));
}