@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix an issue with PHID/handle management in push logs

Summary: Ref T10751. This cleans this up so it's a little more modern, and fixes a possible bad access on the log detail page.

Test Plan: Viewed push log list, viewed push log detail.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10751

Differential Revision: https://secure.phabricator.com/D15765

+16 -25
+1 -2
src/applications/diffusion/controller/DiffusionPushEventViewController.php
··· 50 50 51 51 $updates_table = id(new DiffusionPushLogListView()) 52 52 ->setUser($viewer) 53 - ->setLogs($logs) 54 - ->setHandles($this->loadViewerHandles(mpull($logs, 'getPusherPHID'))); 53 + ->setLogs($logs); 55 54 56 55 $update_box = id(new PHUIObjectBoxView()) 57 56 ->setHeaderText(pht('All Pushed Updates'))
+14 -10
src/applications/diffusion/view/DiffusionPushLogListView.php
··· 3 3 final class DiffusionPushLogListView extends AphrontView { 4 4 5 5 private $logs; 6 - private $handles; 7 6 8 7 public function setLogs(array $logs) { 9 8 assert_instances_of($logs, 'PhabricatorRepositoryPushLog'); ··· 11 10 return $this; 12 11 } 13 12 14 - public function setHandles(array $handles) { 15 - $this->handles = $handles; 16 - return $this; 17 - } 18 - 19 13 public function render() { 20 14 $logs = $this->logs; 21 - $viewer = $this->getUser(); 22 - $handles = $this->handles; 15 + $viewer = $this->getViewer(); 16 + 17 + $handle_phids = array(); 18 + foreach ($logs as $log) { 19 + $handle_phids[] = $log->getPusherPHID(); 20 + $device_phid = $log->getDevicePHID(); 21 + if ($device_phid) { 22 + $handle_phids[] = $device_phid; 23 + } 24 + } 25 + 26 + $handles = $viewer->loadHandles($handle_phids); 23 27 24 28 // Figure out which repositories are editable. We only let you see remote 25 29 // IPs if you have edit capability on a repository. ··· 62 66 63 67 $device_phid = $log->getDevicePHID(); 64 68 if ($device_phid) { 65 - $device = $handles[$device_phid]->renderLink(); 69 + $device = $viewer->renderHandle($device_phid); 66 70 $any_host = true; 67 71 } else { 68 72 $device = null; ··· 81 85 'href' => $repository->getURI(), 82 86 ), 83 87 $repository->getDisplayName()), 84 - $handles[$log->getPusherPHID()]->renderLink(), 88 + $viewer->renderHandle($log->getPusherPHID()), 85 89 $remote_address, 86 90 $log->getPushEvent()->getRemoteProtocol(), 87 91 $device,
+1 -13
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
··· 92 92 return parent::buildSavedQueryFromBuiltin($query_key); 93 93 } 94 94 95 - protected function getRequiredHandlePHIDsForResultList( 96 - array $logs, 97 - PhabricatorSavedQuery $query) { 98 - $phids = array(); 99 - $phids[] = mpull($logs, 'getPusherPHID'); 100 - $phids[] = mpull($logs, 'getDevicePHID'); 101 - $phids = array_mergev($phids); 102 - $phids = array_filter($phids); 103 - return $phids; 104 - } 105 - 106 95 protected function renderResultList( 107 96 array $logs, 108 97 PhabricatorSavedQuery $query, 109 98 array $handles) { 110 99 111 100 $table = id(new DiffusionPushLogListView()) 112 - ->setUser($this->requireViewer()) 113 - ->setHandles($handles) 101 + ->setViewer($this->requireViewer()) 114 102 ->setLogs($logs); 115 103 116 104 return id(new PhabricatorApplicationSearchResultView())