1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

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
This commit is contained in:
vrana 2012-04-03 14:34:34 -07:00
parent 9fc54f4dfb
commit 5623abecbf
8 changed files with 2 additions and 25 deletions

View file

@ -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();

View file

@ -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));

View file

@ -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;
}

View file

@ -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');

View file

@ -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();

View file

@ -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');

View file

@ -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:

View file

@ -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 =