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
This commit is contained in:
		@@ -180,19 +180,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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user