OutputStreamQuery: Add patchset comments when adding patchsets
This keeps more of the per-patchset logic together for later refactors.
Change-Id: I3d98e55fd77363c6403f5d4f46fa70959f00359f
Release-Notes: skip
(cherry picked from commit a261cb9c7dcf515289dd1197829ed2dfdcebfe01)
diff --git a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
index 5008d1b..17e64c6 100644
--- a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
+++ b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
@@ -309,6 +309,11 @@
d,
labelTypes,
accountLoader);
+ if (includeComments) {
+ for (PatchSetAttribute attribute : c.patchSets) {
+ eventFactory.addPatchSetComments(attribute, d.publishedComments(), accountLoader);
+ }
+ }
}
if (includeCurrentPatchSet) {
@@ -334,11 +339,6 @@
if (includeComments) {
eventFactory.addComments(c, d.messages(), accountLoader);
- if (includePatchSets) {
- for (PatchSetAttribute attribute : c.patchSets) {
- eventFactory.addPatchSetComments(attribute, d.publishedComments(), accountLoader);
- }
- }
}
if (includeDependencies) {