Add a "problem commits" prebuilt filter to Audits
Summary: Ref T4715. We show this number on the homepage, provide an easy way to query matching commits. Test Plan: Clicked "problem commits", saw them. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4715 Differential Revision: https://secure.phabricator.com/D8880
This commit is contained in:
		@@ -107,8 +107,10 @@ final class PhabricatorCommitSearchEngine
 | 
				
			|||||||
    $names = array();
 | 
					    $names = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($this->requireViewer()->isLoggedIn()) {
 | 
					    if ($this->requireViewer()->isLoggedIn()) {
 | 
				
			||||||
      $names['need_attention'] = pht('Need Attention');
 | 
					      $names['need'] = pht('Need Attention');
 | 
				
			||||||
 | 
					      $names['problem'] = pht('Problem Commits');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $names['open'] = pht('Open Audits');
 | 
					    $names['open'] = pht('Open Audits');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $names['all'] = pht('All Commits');
 | 
					    $names['all'] = pht('All Commits');
 | 
				
			||||||
@@ -129,7 +131,7 @@ final class PhabricatorCommitSearchEngine
 | 
				
			|||||||
          'auditStatus',
 | 
					          'auditStatus',
 | 
				
			||||||
          DiffusionCommitQuery::AUDIT_STATUS_OPEN);
 | 
					          DiffusionCommitQuery::AUDIT_STATUS_OPEN);
 | 
				
			||||||
        return $query;
 | 
					        return $query;
 | 
				
			||||||
      case 'need_attention':
 | 
					      case 'need':
 | 
				
			||||||
        $query->setParameter('awaitingUserPHID', $viewer->getPHID());
 | 
					        $query->setParameter('awaitingUserPHID', $viewer->getPHID());
 | 
				
			||||||
        $query->setParameter(
 | 
					        $query->setParameter(
 | 
				
			||||||
          'auditStatus',
 | 
					          'auditStatus',
 | 
				
			||||||
@@ -138,6 +140,12 @@ final class PhabricatorCommitSearchEngine
 | 
				
			|||||||
          'auditorPHIDs',
 | 
					          'auditorPHIDs',
 | 
				
			||||||
          PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer));
 | 
					          PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer));
 | 
				
			||||||
        return $query;
 | 
					        return $query;
 | 
				
			||||||
 | 
					      case 'problem':
 | 
				
			||||||
 | 
					        $query->setParameter('commitAuthorPHIDs', array($viewer->getPHID()));
 | 
				
			||||||
 | 
					        $query->setParameter(
 | 
				
			||||||
 | 
					          'auditStatus',
 | 
				
			||||||
 | 
					          DiffusionCommitQuery::AUDIT_STATUS_CONCERN);
 | 
				
			||||||
 | 
					        return $query;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return parent::buildSavedQueryFromBuiltin($query_key);
 | 
					    return parent::buildSavedQueryFromBuiltin($query_key);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -418,6 +418,7 @@ final class PhabricatorHomeMainController
 | 
				
			|||||||
      ->withAuditorPHIDs($phids)
 | 
					      ->withAuditorPHIDs($phids)
 | 
				
			||||||
      ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_OPEN)
 | 
					      ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_OPEN)
 | 
				
			||||||
      ->withAuditAwaitingUser($user)
 | 
					      ->withAuditAwaitingUser($user)
 | 
				
			||||||
 | 
					      ->needAuditRequests(true)
 | 
				
			||||||
      ->needCommitData(true)
 | 
					      ->needCommitData(true)
 | 
				
			||||||
      ->setLimit(10);
 | 
					      ->setLimit(10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -458,6 +459,7 @@ final class PhabricatorHomeMainController
 | 
				
			|||||||
      ->withAuthorPHIDs($phids)
 | 
					      ->withAuthorPHIDs($phids)
 | 
				
			||||||
      ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN)
 | 
					      ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN)
 | 
				
			||||||
      ->needCommitData(true)
 | 
					      ->needCommitData(true)
 | 
				
			||||||
 | 
					      ->needAuditRequests(true)
 | 
				
			||||||
      ->setLimit(10);
 | 
					      ->setLimit(10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $commits = $query->execute();
 | 
					    $commits = $query->execute();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user