summaryrefslogtreecommitdiffstats
path: root/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java')
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java
index 120b9af847..557e017cac 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailFactory.java
@@ -177,13 +177,25 @@ public class ChangeDetailFactory extends Handler<ChangeDetail> {
private void loadPatchSets() throws OrmException {
ResultSet<PatchSet> source = db.patchSets().byChange(changeId);
List<PatchSet> patches = new ArrayList<PatchSet>();
+ Set<PatchSet.Id> patchesWithDraftComments = new HashSet<PatchSet.Id>();
+ final CurrentUser user = control.getCurrentUser();
+ final Account.Id me =
+ user instanceof IdentifiedUser ? ((IdentifiedUser) user).getAccountId()
+ : null;
for (PatchSet ps : source) {
+ final PatchSet.Id psId = ps.getId();
if (control.isPatchVisible(ps, db)) {
patches.add(ps);
+ if (me != null
+ && db.patchComments().draftByPatchSetAuthor(psId, me)
+ .iterator().hasNext()) {
+ patchesWithDraftComments.add(psId);
+ }
}
- patchsetsById.put(ps.getId(), ps);
+ patchsetsById.put(psId, ps);
}
detail.setPatchSets(patches);
+ detail.setPatchSetsWithDraftComments(patchesWithDraftComments);
}
private void loadMessages() throws OrmException {