diff --git a/src/applications/diffusion/controller/DiffusionPushEventViewController.php b/src/applications/diffusion/controller/DiffusionPushEventViewController.php index 027cf16bbe..c5eb6368b4 100644 --- a/src/applications/diffusion/controller/DiffusionPushEventViewController.php +++ b/src/applications/diffusion/controller/DiffusionPushEventViewController.php @@ -50,8 +50,7 @@ final class DiffusionPushEventViewController $updates_table = id(new DiffusionPushLogListView()) ->setUser($viewer) - ->setLogs($logs) - ->setHandles($this->loadViewerHandles(mpull($logs, 'getPusherPHID'))); + ->setLogs($logs); $update_box = id(new PHUIObjectBoxView()) ->setHeaderText(pht('All Pushed Updates')) diff --git a/src/applications/diffusion/view/DiffusionPushLogListView.php b/src/applications/diffusion/view/DiffusionPushLogListView.php index b3d78f2369..303f0519f6 100644 --- a/src/applications/diffusion/view/DiffusionPushLogListView.php +++ b/src/applications/diffusion/view/DiffusionPushLogListView.php @@ -3,7 +3,6 @@ final class DiffusionPushLogListView extends AphrontView { private $logs; - private $handles; public function setLogs(array $logs) { assert_instances_of($logs, 'PhabricatorRepositoryPushLog'); @@ -11,15 +10,20 @@ final class DiffusionPushLogListView extends AphrontView { return $this; } - public function setHandles(array $handles) { - $this->handles = $handles; - return $this; - } - public function render() { $logs = $this->logs; - $viewer = $this->getUser(); - $handles = $this->handles; + $viewer = $this->getViewer(); + + $handle_phids = array(); + foreach ($logs as $log) { + $handle_phids[] = $log->getPusherPHID(); + $device_phid = $log->getDevicePHID(); + if ($device_phid) { + $handle_phids[] = $device_phid; + } + } + + $handles = $viewer->loadHandles($handle_phids); // Figure out which repositories are editable. We only let you see remote // IPs if you have edit capability on a repository. @@ -62,7 +66,7 @@ final class DiffusionPushLogListView extends AphrontView { $device_phid = $log->getDevicePHID(); if ($device_phid) { - $device = $handles[$device_phid]->renderLink(); + $device = $viewer->renderHandle($device_phid); $any_host = true; } else { $device = null; @@ -81,7 +85,7 @@ final class DiffusionPushLogListView extends AphrontView { 'href' => $repository->getURI(), ), $repository->getDisplayName()), - $handles[$log->getPusherPHID()]->renderLink(), + $viewer->renderHandle($log->getPusherPHID()), $remote_address, $log->getPushEvent()->getRemoteProtocol(), $device, diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php index 320558de21..8fd3baeb54 100644 --- a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php @@ -92,25 +92,13 @@ final class PhabricatorRepositoryPushLogSearchEngine return parent::buildSavedQueryFromBuiltin($query_key); } - protected function getRequiredHandlePHIDsForResultList( - array $logs, - PhabricatorSavedQuery $query) { - $phids = array(); - $phids[] = mpull($logs, 'getPusherPHID'); - $phids[] = mpull($logs, 'getDevicePHID'); - $phids = array_mergev($phids); - $phids = array_filter($phids); - return $phids; - } - protected function renderResultList( array $logs, PhabricatorSavedQuery $query, array $handles) { $table = id(new DiffusionPushLogListView()) - ->setUser($this->requireViewer()) - ->setHandles($handles) + ->setViewer($this->requireViewer()) ->setLogs($logs); return id(new PhabricatorApplicationSearchResultView())