1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00

Don't show archived projects by default in policy control

Summary:
When filling in filler projects, only select active ones.

Also use a slightly more modern method signature.

Test Plan: Disabled a project, saw it vanish from the control.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15199
This commit is contained in:
epriestley 2016-02-06 12:40:31 -08:00
parent 5523217fbb
commit 7550557e44
3 changed files with 21 additions and 1 deletions

View file

@ -130,7 +130,10 @@ final class PhabricatorPeopleProfileViewController
->setViewer($viewer) ->setViewer($viewer)
->withMemberPHIDs(array($user->getPHID())) ->withMemberPHIDs(array($user->getPHID()))
->needImages(true) ->needImages(true)
->withStatus(PhabricatorProjectQuery::STATUS_OPEN) ->withStatuses(
array(
PhabricatorProjectStatus::STATUS_ACTIVE,
))
->execute(); ->execute();
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())

View file

@ -230,6 +230,10 @@ final class PhabricatorPolicyQuery
->setViewer($viewer) ->setViewer($viewer)
->withMemberPHIDs(array($viewer->getPHID())) ->withMemberPHIDs(array($viewer->getPHID()))
->withIsMilestone(false) ->withIsMilestone(false)
->withStatuses(
array(
PhabricatorProjectStatus::STATUS_ACTIVE,
))
->setLimit($default_limit) ->setLimit($default_limit)
->execute(); ->execute();
$default_projects = mpull($default_projects, null, 'getPHID'); $default_projects = mpull($default_projects, null, 'getPHID');

View file

@ -27,6 +27,7 @@ final class PhabricatorProjectQuery
const STATUS_CLOSED = 'status-closed'; const STATUS_CLOSED = 'status-closed';
const STATUS_ACTIVE = 'status-active'; const STATUS_ACTIVE = 'status-active';
const STATUS_ARCHIVED = 'status-archived'; const STATUS_ARCHIVED = 'status-archived';
private $statuses;
private $needSlugs; private $needSlugs;
private $needMembers; private $needMembers;
@ -49,6 +50,11 @@ final class PhabricatorProjectQuery
return $this; return $this;
} }
public function withStatuses(array $statuses) {
$this->statuses = $statuses;
return $this;
}
public function withMemberPHIDs(array $member_phids) { public function withMemberPHIDs(array $member_phids) {
$this->memberPHIDs = $member_phids; $this->memberPHIDs = $member_phids;
return $this; return $this;
@ -387,6 +393,13 @@ final class PhabricatorProjectQuery
$filter); $filter);
} }
if ($this->statuses !== null) {
$where[] = qsprintf(
$conn,
'status IN (%Ls)',
$this->statuses);
}
if ($this->ids !== null) { if ($this->ids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,