Fix implicitly cc on non voting review for users without username

This change partially reverts changes done in I97e33caa8e.

Bug: Issue 8377
Change-Id: I9f9c5c3655592d8f7d0b2af330005e9289ea1f81
This commit is contained in:
David Ostrovsky
2018-02-14 23:12:38 +01:00
parent befa751c41
commit 8e946e8ee8
2 changed files with 11 additions and 18 deletions

View File

@@ -135,7 +135,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.Set;
import org.eclipse.jgit.errors.ConfigInvalidException;
@@ -334,11 +333,9 @@ public class PostReview
// User posting this review isn't currently in the reviewer or CC list,
// isn't being explicitly added, and isn't voting on any label.
// Automatically CC them on this change so they receive replies.
Optional<PostReviewers.Addition> selfAddition =
PostReviewers.Addition selfAddition =
postReviewers.ccCurrentUser(revision.getUser(), revision);
if (selfAddition.isPresent()) {
bu.addOp(revision.getChange().getId(), selfAddition.get().op);
}
bu.addOp(revision.getChange().getId(), selfAddition.op);
}
// Add WorkInProgressOp if requested.

View File

@@ -80,7 +80,6 @@ import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Config;
@@ -209,18 +208,15 @@ public class PostReviewers
return addByEmail(reviewer, rsrc, state, notify, accountsToNotify);
}
Optional<Addition> ccCurrentUser(CurrentUser user, RevisionResource revision) {
return user.getUserName()
.map(
u ->
new Addition(
u,
revision.getChangeResource(),
ImmutableSet.of(user.getAccountId()),
null,
CC,
NotifyHandling.NONE,
ImmutableListMultimap.of()));
Addition ccCurrentUser(CurrentUser user, RevisionResource revision) {
return new Addition(
user.getUserName().orElse(null),
revision.getChangeResource(),
ImmutableSet.of(user.getAccountId()),
null,
CC,
NotifyHandling.NONE,
ImmutableListMultimap.of());
}
@Nullable