From 7550557e44282afa77357807984680461e715394 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 6 Feb 2016 12:40:31 -0800 Subject: [PATCH] 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 --- .../PhabricatorPeopleProfileViewController.php | 5 ++++- .../policy/query/PhabricatorPolicyQuery.php | 4 ++++ .../project/query/PhabricatorProjectQuery.php | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 45125c28b0..ed2a2189a6 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -130,7 +130,10 @@ final class PhabricatorPeopleProfileViewController ->setViewer($viewer) ->withMemberPHIDs(array($user->getPHID())) ->needImages(true) - ->withStatus(PhabricatorProjectQuery::STATUS_OPEN) + ->withStatuses( + array( + PhabricatorProjectStatus::STATUS_ACTIVE, + )) ->execute(); $header = id(new PHUIHeaderView()) diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php index df1d6fb0b8..e6e7008827 100644 --- a/src/applications/policy/query/PhabricatorPolicyQuery.php +++ b/src/applications/policy/query/PhabricatorPolicyQuery.php @@ -230,6 +230,10 @@ final class PhabricatorPolicyQuery ->setViewer($viewer) ->withMemberPHIDs(array($viewer->getPHID())) ->withIsMilestone(false) + ->withStatuses( + array( + PhabricatorProjectStatus::STATUS_ACTIVE, + )) ->setLimit($default_limit) ->execute(); $default_projects = mpull($default_projects, null, 'getPHID'); diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php index 304dd956e1..f4711bb4f7 100644 --- a/src/applications/project/query/PhabricatorProjectQuery.php +++ b/src/applications/project/query/PhabricatorProjectQuery.php @@ -27,6 +27,7 @@ final class PhabricatorProjectQuery const STATUS_CLOSED = 'status-closed'; const STATUS_ACTIVE = 'status-active'; const STATUS_ARCHIVED = 'status-archived'; + private $statuses; private $needSlugs; private $needMembers; @@ -49,6 +50,11 @@ final class PhabricatorProjectQuery return $this; } + public function withStatuses(array $statuses) { + $this->statuses = $statuses; + return $this; + } + public function withMemberPHIDs(array $member_phids) { $this->memberPHIDs = $member_phids; return $this; @@ -387,6 +393,13 @@ final class PhabricatorProjectQuery $filter); } + if ($this->statuses !== null) { + $where[] = qsprintf( + $conn, + 'status IN (%Ls)', + $this->statuses); + } + if ($this->ids !== null) { $where[] = qsprintf( $conn,