Merge "Add attention-set email footer"
This commit is contained in:
@@ -18,6 +18,7 @@ package com.google.gerrit.mail;
|
||||
public enum MailHeader {
|
||||
// Gerrit metadata holders
|
||||
ASSIGNEE("Gerrit-Assignee"),
|
||||
ATTENTION("Gerrit-Attention"),
|
||||
BRANCH("Gerrit-Branch"),
|
||||
CC("Gerrit-CC"),
|
||||
COMMENT_IN_REPLY_TO("Comment-In-Reply-To"),
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
package com.google.gerrit.server.mail.send;
|
||||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.gerrit.server.util.AttentionSetUtil.additionsOnly;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -484,6 +487,9 @@ public abstract class ChangeEmail extends NotificationEmail {
|
||||
for (String reviewer : getEmailsByState(ReviewerStateInternal.CC)) {
|
||||
footers.add(MailHeader.CC.withDelimiter() + reviewer);
|
||||
}
|
||||
for (String attentionSet : getAttentionSet()) {
|
||||
footers.add(MailHeader.ATTENTION.withDelimiter() + attentionSet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,6 +515,19 @@ public abstract class ChangeEmail extends NotificationEmail {
|
||||
return reviewers;
|
||||
}
|
||||
|
||||
private Set<String> getAttentionSet() {
|
||||
Set<String> attentionSet = new TreeSet<>();
|
||||
try {
|
||||
attentionSet =
|
||||
additionsOnly(changeData.attentionSet()).stream()
|
||||
.map(a -> getNameEmailFor(a.account()))
|
||||
.collect(toImmutableSet());
|
||||
} catch (StorageException e) {
|
||||
logger.atWarning().withCause(e).log("Cannot get change attention set");
|
||||
}
|
||||
return attentionSet;
|
||||
}
|
||||
|
||||
public boolean getIncludeDiff() {
|
||||
return args.settings.includeDiff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user