From ec57678f709755d5aec44ec2f396f2027abd3a2a Mon Sep 17 00:00:00 2001 From: Ricky Elrod Date: Wed, 26 Dec 2012 17:10:29 -0800 Subject: [PATCH] Mark deleted Phriction pages as closed. Summary: This replaces D4042 and gives you the option to search for existing Phrication documents only. Test Plan: # Reindexed ALL THE THINGS, saw existing documents show up in search in all cases. # Deleted a document and saw it only show up when "Open and Closed Documents" are shown. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4289 --- .../phid/handle/PhabricatorObjectHandleData.php | 4 ++++ .../phriction/search/PhrictionSearchIndexer.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/applications/phid/handle/PhabricatorObjectHandleData.php b/src/applications/phid/handle/PhabricatorObjectHandleData.php index 4cba669f1a..ccc4556718 100644 --- a/src/applications/phid/handle/PhabricatorObjectHandleData.php +++ b/src/applications/phid/handle/PhabricatorObjectHandleData.php @@ -505,6 +505,10 @@ final class PhabricatorObjectHandleData { $handle->setName($info['title']); $handle->setURI(PhrictionDocument::getSlugURI($info['slug'])); $handle->setComplete(true); + if ($info['status'] != PhrictionDocumentStatus::STATUS_EXISTS) { + $closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; + $handle->setStatus($closed); + } } $handles[$phid] = $handle; } diff --git a/src/applications/phriction/search/PhrictionSearchIndexer.php b/src/applications/phriction/search/PhrictionSearchIndexer.php index f2565b2495..5786e05a4f 100644 --- a/src/applications/phriction/search/PhrictionSearchIndexer.php +++ b/src/applications/phriction/search/PhrictionSearchIndexer.php @@ -37,6 +37,14 @@ final class PhrictionSearchIndexer PhabricatorPHIDConstants::PHID_TYPE_USER, $content->getDateCreated()); + if ($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) { + $doc->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $document->getPHID(), + PhabricatorPHIDConstants::PHID_TYPE_WIKI, + time()); + } + return $doc; } } -- 2.51.2