Refactor highlighting patch sets that have drafts

As suggested in the comments under change
I537db90a940c9df7c4b7c28974adac5b29c8abf4:
- Remove an unrelated field from a PatchSet entity class
- Remove highlighting of the patch set label
- Add a "comment" icon to a patch set header to indicate that it has draft
  comment(s)

Bug: Issue 667
Change-Id: Ie37be962ecb7beb82e85174492e154db9df6175c
(cherry picked from commit 61e18b0595)
This commit is contained in:
Jan Opacki
2013-05-05 15:35:25 +02:00
committed by David Pursehouse
parent 2c7acce786
commit 9b42620385
11 changed files with 39 additions and 29 deletions

View File

@@ -177,19 +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 CurrentUser user = control.getCurrentUser();
if (user instanceof IdentifiedUser) {
final Account.Id me = ((IdentifiedUser) user).getAccountId();
ps.setHasDraftComments(db.patchComments()
.draftByPatchSetAuthor(ps.getId(), me).iterator().hasNext());
}
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 {