Change some accessor methods in CommentChangeEmailDecorator.
This would allow to duplicate less code when creating email override by
extending this class.
Google-Bug-Id: b/266904943
Release-Notes: skip
Change-Id: Icdd1ac9013bcb0fd3d2c53c785a6d7b50512196d
diff --git a/java/com/google/gerrit/server/mail/send/CommentChangeEmailDecoratorImpl.java b/java/com/google/gerrit/server/mail/send/CommentChangeEmailDecoratorImpl.java
index 2ccd0f1..c54c488 100644
--- a/java/com/google/gerrit/server/mail/send/CommentChangeEmailDecoratorImpl.java
+++ b/java/com/google/gerrit/server/mail/send/CommentChangeEmailDecoratorImpl.java
@@ -68,9 +68,9 @@
/** Send comments, after the author of them hit used Publish Comments in the UI. */
@AutoFactory
public class CommentChangeEmailDecoratorImpl implements CommentChangeEmailDecorator {
- private static final FluentLogger logger = FluentLogger.forEnclosingClass();
+ protected static final FluentLogger logger = FluentLogger.forEnclosingClass();
- private class FileCommentGroup {
+ protected class FileCommentGroup {
public String filename;
public int patchSetId;
@@ -123,13 +123,13 @@
}
}
- private EmailArguments args;
- private OutgoingEmail email;
- private ChangeEmail changeEmail;
- private List<? extends Comment> inlineComments = Collections.emptyList();
- @Nullable private String patchSetComment;
- private List<LabelVote> labels = ImmutableList.of();
- private final CommentsUtil commentsUtil;
+ protected EmailArguments args;
+ protected OutgoingEmail email;
+ protected ChangeEmail changeEmail;
+ protected List<? extends Comment> inlineComments = Collections.emptyList();
+ @Nullable protected String patchSetComment;
+ protected List<LabelVote> labels = ImmutableList.of();
+ protected final CommentsUtil commentsUtil;
private final boolean incomingEmailEnabled;
private final String replyToAddress;
private final Supplier<Map<SubmitRequirement, SubmitRequirementResult>>
@@ -241,7 +241,7 @@
}
/** Get the set of accounts whose comments have been replied to in this email. */
- private HashSet<Account.Id> getReplyAccounts() {
+ protected HashSet<Account.Id> getReplyAccounts() {
HashSet<Account.Id> replyAccounts = new HashSet<>();
// Track visited parent UUIDs to avoid cycles.
HashSet<String> visitedUuids = new HashSet<>();
@@ -456,7 +456,7 @@
return commentGroups;
}
- private List<Map<String, Object>> commentBlocksToSoyData(List<CommentFormatter.Block> blocks) {
+ protected List<Map<String, Object>> commentBlocksToSoyData(List<CommentFormatter.Block> blocks) {
return blocks.stream()
.map(
b -> {
@@ -494,7 +494,7 @@
}
@Nullable
- private Repository getRepository() {
+ protected Repository getRepository() {
try {
return args.server.openRepository(changeEmail.getProjectState().getNameKey());
} catch (IOException e) {
@@ -612,7 +612,7 @@
.collect(toImmutableList());
}
- private String getLine(PatchFile fileInfo, short side, int lineNbr) {
+ protected String getLine(PatchFile fileInfo, short side, int lineNbr) {
try {
return fileInfo.getLine(side, lineNbr);
} catch (IOException err) {
@@ -646,7 +646,7 @@
return result.build();
}
- private String getCommentTimestamp() {
+ protected String getCommentTimestamp() {
// Grouping is currently done by timestamp.
return MailProcessingUtil.rfcDateformatter.format(
ZonedDateTime.ofInstant(changeEmail.getTimestamp(), ZoneId.of("UTC")));