From 463552ade3c7f55c33e25940bcdfe6e1d4d840f0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 14 Feb 2014 13:52:48 -0800 Subject: [PATCH] Respect project closure states in fulltext search and handles Summary: See thread; these are just bugs. Handles and main search do not mark projects correctly as open/closed. Test Plan: Searched for projects and observed they respect the open/closed flags properly after reidnexing. Reviewers: chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D8237 --- .../project/phid/PhabricatorProjectPHIDTypeProject.php | 4 ++++ .../project/search/PhabricatorProjectSearchIndexer.php | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php index c4de156143..a03c3d7e48 100644 --- a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php +++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php @@ -42,6 +42,10 @@ final class PhabricatorProjectPHIDTypeProject extends PhabricatorPHIDType { $handle->setName($name); $handle->setObjectName('#'.rtrim($project->getPhrictionSlug(), '/')); $handle->setURI("/project/view/{$id}/"); + + if ($project->isArchived()) { + $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); + } } } diff --git a/src/applications/project/search/PhabricatorProjectSearchIndexer.php b/src/applications/project/search/PhabricatorProjectSearchIndexer.php index faffced07a..ee29969f2d 100644 --- a/src/applications/project/search/PhabricatorProjectSearchIndexer.php +++ b/src/applications/project/search/PhabricatorProjectSearchIndexer.php @@ -20,6 +20,15 @@ final class PhabricatorProjectSearchIndexer $this->indexSubscribers($doc); $this->indexCustomFields($doc, $project); + $doc->addRelationship( + $project->isArchived() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $project->getPHID(), + PhabricatorProjectPHIDTypeProject::TYPECONST, + time()); + + // NOTE: This could be more full-featured, but for now we're mostly // interested in the side effects of indexing.