mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
enabled Audit to filter Concern vs. No-Concern status
Summary: Fixes T2582 You can filter Concern vs. No-Concern status Choosing a concern filter that's not `all` implies filter `status` to be `open` Test Plan: fiddled around with it in Audit Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2582 Differential Revision: https://secure.phabricator.com/D5140
This commit is contained in:
parent
362511c3ae
commit
7f6ea1cd5e
4 changed files with 38 additions and 13 deletions
|
@ -24,4 +24,11 @@ final class PhabricatorAuditCommitStatusConstants {
|
|||
return idx(self::getStatusNameMap(), $code, 'Unknown');
|
||||
}
|
||||
|
||||
public static function getOpenStatusConstants() {
|
||||
return array(
|
||||
self::CONCERN_RAISED,
|
||||
self::NEEDS_AUDIT,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
|
|||
private $filter;
|
||||
private $name;
|
||||
private $filterStatus;
|
||||
private $filterConcern;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->filter = idx($data, 'filter');
|
||||
|
@ -38,6 +39,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
|
|||
}
|
||||
|
||||
$this->filterStatus = $request->getStr('status', 'all');
|
||||
|
||||
$handle = $this->loadHandle();
|
||||
|
||||
$nav->appendChild($this->buildListFilters($handle));
|
||||
|
@ -187,6 +189,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
|
|||
array(
|
||||
'all' => pht('All'),
|
||||
'open' => pht('Open'),
|
||||
'concern' => pht('Concern Raised'),
|
||||
)));
|
||||
}
|
||||
|
||||
|
@ -346,20 +349,19 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
|
|||
}
|
||||
|
||||
switch ($this->filter) {
|
||||
case 'audits':
|
||||
case 'user':
|
||||
case 'project':
|
||||
case 'package':
|
||||
case 'repository':
|
||||
case 'active':
|
||||
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
|
||||
break;
|
||||
default:
|
||||
switch ($this->filterStatus) {
|
||||
case 'open':
|
||||
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
|
||||
break;
|
||||
case 'concern':
|
||||
$query->withStatus(PhabricatorAuditQuery::STATUS_CONCERN);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'active':
|
||||
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($handle) {
|
||||
|
@ -454,13 +456,15 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
|
|||
|
||||
switch ($this->filter) {
|
||||
case 'active':
|
||||
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
|
||||
$query->withStatus(PhabricatorAuditCommitQuery::STATUS_OPEN);
|
||||
break;
|
||||
case 'author':
|
||||
case 'packagecommits':
|
||||
default:
|
||||
switch ($this->filterStatus) {
|
||||
case 'open':
|
||||
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
|
||||
$query->withStatus(PhabricatorAuditCommitQuery::STATUS_OPEN);
|
||||
break;
|
||||
case 'concern':
|
||||
$query->withStatus(PhabricatorAuditCommitQuery::STATUS_CONCERN);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -16,6 +16,7 @@ final class PhabricatorAuditCommitQuery {
|
|||
private $status = 'status-any';
|
||||
const STATUS_ANY = 'status-any';
|
||||
const STATUS_OPEN = 'status-open';
|
||||
const STATUS_CONCERN = 'status-concern';
|
||||
|
||||
public function withAuthorPHIDs(array $author_phids) {
|
||||
$this->authorPHIDs = $author_phids;
|
||||
|
@ -177,12 +178,18 @@ final class PhabricatorAuditCommitQuery {
|
|||
|
||||
$status = $this->status;
|
||||
switch ($status) {
|
||||
case self::STATUS_OPEN:
|
||||
case self::STATUS_CONCERN:
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'c.auditStatus = %s',
|
||||
PhabricatorAuditCommitStatusConstants::CONCERN_RAISED);
|
||||
break;
|
||||
case self::STATUS_OPEN:
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'c.auditStatus IN (%Ls)',
|
||||
PhabricatorAuditCommitStatusConstants::getOpenStatusConstants());
|
||||
break;
|
||||
case self::STATUS_ANY:
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -18,6 +18,7 @@ final class PhabricatorAuditQuery {
|
|||
private $status = 'status-any';
|
||||
const STATUS_ANY = 'status-any';
|
||||
const STATUS_OPEN = 'status-open';
|
||||
const STATUS_CONCERN = 'status-concern';
|
||||
|
||||
private $commits;
|
||||
|
||||
|
@ -190,6 +191,12 @@ final class PhabricatorAuditQuery {
|
|||
|
||||
$status = $this->status;
|
||||
switch ($status) {
|
||||
case self::STATUS_CONCERN:
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'req.auditStatus = %s',
|
||||
PhabricatorAuditStatusConstants::CONCERNED);
|
||||
break;
|
||||
case self::STATUS_OPEN:
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
|
|
Loading…
Reference in a new issue