From 5623abecbf83e405db6dbc534c9a7715cf76a121 Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 3 Apr 2012 14:34:34 -0700 Subject: [PATCH] Don't set NULL values in array returned from loadObjects() Summary: Delete some dead code in Feed along the way. Test Plan: /feed/ /search/ Reviewers: epriestley Reviewed By: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D2092 --- .../method/feed/query/ConduitAPI_feed_query_Method.php | 4 ---- .../feed/builder/feed/PhabricatorFeedBuilder.php | 4 ---- .../feed/story/base/PhabricatorFeedStory.php | 10 ---------- .../differential/PhabricatorFeedStoryDifferential.php | 2 -- .../story/maniphest/PhabricatorFeedStoryManiphest.php | 1 - .../story/phriction/PhabricatorFeedStoryPhriction.php | 2 -- .../phid/handle/data/PhabricatorObjectHandleData.php | 2 +- .../controller/search/PhabricatorSearchController.php | 2 +- 8 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/applications/conduit/method/feed/query/ConduitAPI_feed_query_Method.php b/src/applications/conduit/method/feed/query/ConduitAPI_feed_query_Method.php index 62a60b56da..82121d5de8 100644 --- a/src/applications/conduit/method/feed/query/ConduitAPI_feed_query_Method.php +++ b/src/applications/conduit/method/feed/query/ConduitAPI_feed_query_Method.php @@ -89,16 +89,12 @@ final class ConduitAPI_feed_query_Method extends ConduitAPIMethod { if ($stories) { $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); - $object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs')); $handles = id(new PhabricatorObjectHandleData($handle_phids)) ->loadHandles(); - $objects = id(new PhabricatorObjectHandleData($object_phids)) - ->loadObjects(); foreach ($stories as $story) { $story->setHandles($handles); - $story->setObjects($objects); $story_data = $story->getStoryData(); diff --git a/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php b/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php index 5fc9958923..b51a42e722 100644 --- a/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php +++ b/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php @@ -44,14 +44,11 @@ final class PhabricatorFeedBuilder { $stories = $this->stories; $handles = array(); - $objects = array(); if ($stories) { $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); $object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs')); $handles = id(new PhabricatorObjectHandleData($handle_phids)) ->loadHandles(); - $objects = id(new PhabricatorObjectHandleData($object_phids)) - ->loadObjects(); } $null_view = new AphrontNullView(); @@ -61,7 +58,6 @@ final class PhabricatorFeedBuilder { $last_date = null; foreach ($stories as $story) { $story->setHandles($handles); - $story->setObjects($objects); $story->setFramed($this->framed); $date = ucfirst(phabricator_relative_date($story->getEpoch(), $user)); diff --git a/src/applications/feed/story/base/PhabricatorFeedStory.php b/src/applications/feed/story/base/PhabricatorFeedStory.php index 7ab94f12c0..7bc3a46cb0 100644 --- a/src/applications/feed/story/base/PhabricatorFeedStory.php +++ b/src/applications/feed/story/base/PhabricatorFeedStory.php @@ -21,7 +21,6 @@ abstract class PhabricatorFeedStory { private $data; private $handles; - private $objects; private $framed; final public function __construct(PhabricatorFeedStoryData $data) { @@ -48,11 +47,6 @@ abstract class PhabricatorFeedStory { return $this; } - final public function setObjects(array $objects) { - $this->objects = $objects; - return $this; - } - final protected function getHandles() { return $this->handles; } @@ -71,10 +65,6 @@ abstract class PhabricatorFeedStory { return $handle; } - final protected function getObjects() { - return $this->objects; - } - final public function getStoryData() { return $this->data; } diff --git a/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php index eda2e154b1..15113cdca5 100644 --- a/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php +++ b/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php @@ -38,8 +38,6 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { $author_phid = $data->getAuthorPHID(); - $objects = $this->getObjects(); - $view = new PhabricatorFeedStoryView(); $revision_phid = $data->getValue('revision_phid'); diff --git a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php index c16afa5ff4..6defa7c10b 100644 --- a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php +++ b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php @@ -41,7 +41,6 @@ final class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory { $owner_phid = $data->getValue('ownerPHID'); $task_phid = $data->getValue('taskPHID'); - $objects = $this->getObjects(); $action = $data->getValue('action'); $view = new PhabricatorFeedStoryView(); diff --git a/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php b/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php index 0f03fdc304..8cadf1ece5 100644 --- a/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php +++ b/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php @@ -37,8 +37,6 @@ final class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory { $author_phid = $data->getAuthorPHID(); $document_phid = $data->getValue('phid'); - $objects = $this->getObjects(); - $view = new PhabricatorFeedStoryView(); $action = $data->getValue('action'); diff --git a/src/applications/phid/handle/data/PhabricatorObjectHandleData.php b/src/applications/phid/handle/data/PhabricatorObjectHandleData.php index 1aced1f81f..0233adead4 100644 --- a/src/applications/phid/handle/data/PhabricatorObjectHandleData.php +++ b/src/applications/phid/handle/data/PhabricatorObjectHandleData.php @@ -36,7 +36,7 @@ final class PhabricatorObjectHandleData { $types[$type][] = $phid; } - $objects = array_fill_keys($this->phids, null); + $objects = array(); foreach ($types as $type => $phids) { switch ($type) { case PhabricatorPHIDConstants::PHID_TYPE_USER: diff --git a/src/applications/search/controller/search/PhabricatorSearchController.php b/src/applications/search/controller/search/PhabricatorSearchController.php index 754f150452..05c4bc233f 100644 --- a/src/applications/search/controller/search/PhabricatorSearchController.php +++ b/src/applications/search/controller/search/PhabricatorSearchController.php @@ -275,7 +275,7 @@ final class PhabricatorSearchController $view = new PhabricatorSearchResultView(); $view->setHandle($handle); $view->setQuery($query); - $view->setObject($objects[$phid]); + $view->setObject(idx($objects, $phid)); $results[] = $view->render(); } $results =