Changeset View
Changeset View
Standalone View
Standalone View
src/applications/feed/story/PhabricatorFeedStory.php
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | foreach ($stories as $key => $story) { | ||||
} | } | ||||
if ($story->getPrimaryObjectPHID()) { | if ($story->getPrimaryObjectPHID()) { | ||||
$phids[$story->getPrimaryObjectPHID()] = true; | $phids[$story->getPrimaryObjectPHID()] = true; | ||||
} | } | ||||
$key_phids[$key] = $phids; | $key_phids[$key] = $phids; | ||||
$object_phids += $phids; | $object_phids += $phids; | ||||
} | } | ||||
$objects = id(new PhabricatorObjectQuery()) | $object_query = id(new PhabricatorObjectQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array_keys($object_phids)) | ->withPHIDs(array_keys($object_phids)); | ||||
->execute(); | |||||
$objects = $object_query->execute(); | |||||
foreach ($key_phids as $key => $phids) { | foreach ($key_phids as $key => $phids) { | ||||
if (!$phids) { | if (!$phids) { | ||||
continue; | continue; | ||||
} | } | ||||
$story_objects = array_select_keys($objects, array_keys($phids)); | $story_objects = array_select_keys($objects, array_keys($phids)); | ||||
if (count($story_objects) != count($phids)) { | if (count($story_objects) != count($phids)) { | ||||
// An object this story requires either does not exist or is not visible | // An object this story requires either does not exist or is not visible | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | foreach ($stories as $key => $story) { | ||||
$story->setProjectPHIDs($object_project_phids); | $story->setProjectPHIDs($object_project_phids); | ||||
foreach ($object_project_phids as $dst) { | foreach ($object_project_phids as $dst) { | ||||
$key_phids[$key][$dst] = true; | $key_phids[$key][$dst] = true; | ||||
} | } | ||||
$handle_phids += $key_phids[$key]; | $handle_phids += $key_phids[$key]; | ||||
} | } | ||||
// NOTE: This setParentQuery() is a little sketchy. Ideally, this whole | |||||
// method should be inside FeedQuery and it should be the parent query of | |||||
// both subqueries. We're just trying to share the workspace cache. | |||||
$handles = id(new PhabricatorHandleQuery()) | $handles = id(new PhabricatorHandleQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setParentQuery($object_query) | |||||
->withPHIDs(array_keys($handle_phids)) | ->withPHIDs(array_keys($handle_phids)) | ||||
->execute(); | ->execute(); | ||||
foreach ($key_phids as $key => $phids) { | foreach ($key_phids as $key => $phids) { | ||||
if (!$phids) { | if (!$phids) { | ||||
continue; | continue; | ||||
} | } | ||||
$story_handles = array_select_keys($handles, array_keys($phids)); | $story_handles = array_select_keys($handles, array_keys($phids)); | ||||
▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines |