1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-09 14:21:02 +01: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) { if ($stories) {
$handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs'));
$object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs'));
$handles = id(new PhabricatorObjectHandleData($handle_phids)) $handles = id(new PhabricatorObjectHandleData($handle_phids))
->loadHandles(); ->loadHandles();
$objects = id(new PhabricatorObjectHandleData($object_phids))
->loadObjects();
foreach ($stories as $story) { foreach ($stories as $story) {
$story->setHandles($handles); $story->setHandles($handles);
$story->setObjects($objects);
$story_data = $story->getStoryData(); $story_data = $story->getStoryData();

View file

@ -44,14 +44,11 @@ final class PhabricatorFeedBuilder {
$stories = $this->stories; $stories = $this->stories;
$handles = array(); $handles = array();
$objects = array();
if ($stories) { if ($stories) {
$handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs'));
$object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs')); $object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs'));
$handles = id(new PhabricatorObjectHandleData($handle_phids)) $handles = id(new PhabricatorObjectHandleData($handle_phids))
->loadHandles(); ->loadHandles();
$objects = id(new PhabricatorObjectHandleData($object_phids))
->loadObjects();
} }
$null_view = new AphrontNullView(); $null_view = new AphrontNullView();
@ -61,7 +58,6 @@ final class PhabricatorFeedBuilder {
$last_date = null; $last_date = null;
foreach ($stories as $story) { foreach ($stories as $story) {
$story->setHandles($handles); $story->setHandles($handles);
$story->setObjects($objects);
$story->setFramed($this->framed); $story->setFramed($this->framed);
$date = ucfirst(phabricator_relative_date($story->getEpoch(), $user)); $date = ucfirst(phabricator_relative_date($story->getEpoch(), $user));

View file

@ -21,7 +21,6 @@ abstract class PhabricatorFeedStory {
private $data; private $data;
private $handles; private $handles;
private $objects;
private $framed; private $framed;
final public function __construct(PhabricatorFeedStoryData $data) { final public function __construct(PhabricatorFeedStoryData $data) {
@ -48,11 +47,6 @@ abstract class PhabricatorFeedStory {
return $this; return $this;
} }
final public function setObjects(array $objects) {
$this->objects = $objects;
return $this;
}
final protected function getHandles() { final protected function getHandles() {
return $this->handles; return $this->handles;
} }
@ -71,10 +65,6 @@ abstract class PhabricatorFeedStory {
return $handle; return $handle;
} }
final protected function getObjects() {
return $this->objects;
}
final public function getStoryData() { final public function getStoryData() {
return $this->data; return $this->data;
} }

View file

@ -38,8 +38,6 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
$author_phid = $data->getAuthorPHID(); $author_phid = $data->getAuthorPHID();
$objects = $this->getObjects();
$view = new PhabricatorFeedStoryView(); $view = new PhabricatorFeedStoryView();
$revision_phid = $data->getValue('revision_phid'); $revision_phid = $data->getValue('revision_phid');

View file

@ -41,7 +41,6 @@ final class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
$owner_phid = $data->getValue('ownerPHID'); $owner_phid = $data->getValue('ownerPHID');
$task_phid = $data->getValue('taskPHID'); $task_phid = $data->getValue('taskPHID');
$objects = $this->getObjects();
$action = $data->getValue('action'); $action = $data->getValue('action');
$view = new PhabricatorFeedStoryView(); $view = new PhabricatorFeedStoryView();

View file

@ -37,8 +37,6 @@ final class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory {
$author_phid = $data->getAuthorPHID(); $author_phid = $data->getAuthorPHID();
$document_phid = $data->getValue('phid'); $document_phid = $data->getValue('phid');
$objects = $this->getObjects();
$view = new PhabricatorFeedStoryView(); $view = new PhabricatorFeedStoryView();
$action = $data->getValue('action'); $action = $data->getValue('action');

View file

@ -36,7 +36,7 @@ final class PhabricatorObjectHandleData {
$types[$type][] = $phid; $types[$type][] = $phid;
} }
$objects = array_fill_keys($this->phids, null); $objects = array();
foreach ($types as $type => $phids) { foreach ($types as $type => $phids) {
switch ($type) { switch ($type) {
case PhabricatorPHIDConstants::PHID_TYPE_USER: case PhabricatorPHIDConstants::PHID_TYPE_USER:

View file

@ -275,7 +275,7 @@ final class PhabricatorSearchController
$view = new PhabricatorSearchResultView(); $view = new PhabricatorSearchResultView();
$view->setHandle($handle); $view->setHandle($handle);
$view->setQuery($query); $view->setQuery($query);
$view->setObject($objects[$phid]); $view->setObject(idx($objects, $phid));
$results[] = $view->render(); $results[] = $view->render();
} }
$results = $results =