diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 32cfb0966a..6bd9b40f40 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -494,6 +494,11 @@ final class ManiphestTask extends ManiphestDAO $closed_epoch = (int)$closed_epoch; } + $group_by_phid = $this->groupByProjectPHID; + if ($group_by_phid === self::ATTACHABLE) { + $group_by_phid = null; + } + return array( 'name' => $this->getTitle(), 'description' => array( @@ -507,6 +512,7 @@ final class ManiphestTask extends ManiphestDAO 'subtype' => $this->getSubtype(), 'closerPHID' => $this->getCloserPHID(), 'dateClosed' => $closed_epoch, + 'groupByProjectPHID' => $group_by_phid, ); } diff --git a/src/applications/project/constants/PhabricatorProjectStatus.php b/src/applications/project/constants/PhabricatorProjectStatus.php index 79b1ee823c..5138bb2d2b 100644 --- a/src/applications/project/constants/PhabricatorProjectStatus.php +++ b/src/applications/project/constants/PhabricatorProjectStatus.php @@ -5,6 +5,9 @@ final class PhabricatorProjectStatus extends Phobject { const STATUS_ACTIVE = 0; const STATUS_ARCHIVED = 100; + const STATUS_ACTIVE_KEY = 'active'; + const STATUS_ARCHIVED_KEY = 'archived'; + public static function getNameForStatus($status) { $map = array( self::STATUS_ACTIVE => pht('Active'), @@ -21,4 +24,14 @@ final class PhabricatorProjectStatus extends Phobject { ); } + public static function getStatusKeys() { + return array( + self::STATUS_ACTIVE_KEY => self::STATUS_ACTIVE, + self::STATUS_ARCHIVED_KEY => self::STATUS_ARCHIVED, + ); + } + + public static function getKeyForStatus(int $status) { + return array_flip(self::getStatusKeys())[$status]; + } } diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php index 0c96d72994..8d18c9eb24 100644 --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -247,37 +247,45 @@ final class PhabricatorProjectSearchEngine // By default, do not show milestones in the list view. $query->setParameter('isMilestone', false); + $active = PhabricatorProjectStatus::STATUS_ACTIVE_KEY; + switch ($query_key) { case 'all': return $query; case 'active': return $query - ->setParameter('status', 'active'); + ->setParameter('status', $active); case 'joined': return $query ->setParameter('memberPHIDs', array($viewer_phid)) - ->setParameter('status', 'active'); + ->setParameter('status', $active); case 'watching': return $query ->setParameter('watcherPHIDs', array($viewer_phid)) - ->setParameter('status', 'active'); + ->setParameter('status', $active); } return parent::buildSavedQueryFromBuiltin($query_key); } private function getStatusOptions() { + $active = PhabricatorProjectStatus::STATUS_ACTIVE_KEY; + $archived = PhabricatorProjectStatus::STATUS_ARCHIVED_KEY; + return array( - 'active' => pht('Show Only Active Projects'), - 'archived' => pht('Show Only Archived Projects'), + $active => pht('Show Only Active Projects'), + $archived => pht('Show Only Archived Projects'), 'all' => pht('Show All Projects'), ); } private function getStatusValues() { + $active = PhabricatorProjectStatus::STATUS_ACTIVE_KEY; + $archived = PhabricatorProjectStatus::STATUS_ARCHIVED_KEY; + return array( - 'active' => PhabricatorProjectQuery::STATUS_ACTIVE, - 'archived' => PhabricatorProjectQuery::STATUS_ARCHIVED, + $active => PhabricatorProjectQuery::STATUS_ACTIVE, + $archived => PhabricatorProjectQuery::STATUS_ARCHIVED, 'all' => PhabricatorProjectQuery::STATUS_ANY, ); } diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 7fcf1b2f35..53dd5f1ff9 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -930,6 +930,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO 'key' => $color_key, 'name' => $color_name, ), + 'status' => PhabricatorProjectStatus::getKeyForStatus($this->getStatus()), ); } diff --git a/src/applications/search/field/PhabricatorSearchSelectField.php b/src/applications/search/field/PhabricatorSearchSelectField.php index 0806174220..7c735f26b5 100644 --- a/src/applications/search/field/PhabricatorSearchSelectField.php +++ b/src/applications/search/field/PhabricatorSearchSelectField.php @@ -33,4 +33,19 @@ final class PhabricatorSearchSelectField ->setOptions($this->getOptions()); } + protected function newConduitParameterType() { + return new ConduitStringParameterType(); + } + + public function newConduitConstants() { + $list = array(); + + foreach ($this->getOptions() as $key => $option) { + $list[] = id(new ConduitConstantDescription()) + ->setKey($key) + ->setValue($option); + } + + return $list; + } }