Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/view/DiffusionPushLogListView.php
| Show All 19 Lines | foreach ($logs as $log) { | ||||
| $device_phid = $log->getDevicePHID(); | $device_phid = $log->getDevicePHID(); | ||||
| if ($device_phid) { | if ($device_phid) { | ||||
| $handle_phids[] = $device_phid; | $handle_phids[] = $device_phid; | ||||
| } | } | ||||
| } | } | ||||
| $handles = $viewer->loadHandles($handle_phids); | $handles = $viewer->loadHandles($handle_phids); | ||||
| // Figure out which repositories are editable. We only let you see remote | // Only administrators can view remote addresses. | ||||
| // IPs if you have edit capability on a repository. | $remotes_visible = $viewer->getIsAdmin(); | ||||
| $editable_repos = array(); | |||||
| if ($logs) { | |||||
| $editable_repos = id(new PhabricatorRepositoryQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->requireCapabilities( | |||||
| array( | |||||
| PhabricatorPolicyCapability::CAN_VIEW, | |||||
| PhabricatorPolicyCapability::CAN_EDIT, | |||||
| )) | |||||
| ->withPHIDs(mpull($logs, 'getRepositoryPHID')) | |||||
| ->execute(); | |||||
| $editable_repos = mpull($editable_repos, null, 'getPHID'); | |||||
| } | |||||
| $rows = array(); | $rows = array(); | ||||
| $any_host = false; | $any_host = false; | ||||
| foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
| $repository = $log->getRepository(); | $repository = $log->getRepository(); | ||||
| // Reveal this if it's valid and the user can edit the repository. | if ($remotes_visible) { | ||||
| $remote_address = '-'; | |||||
| if (isset($editable_repos[$log->getRepositoryPHID()])) { | |||||
| $remote_address = $log->getPushEvent()->getRemoteAddress(); | $remote_address = $log->getPushEvent()->getRemoteAddress(); | ||||
| } else { | |||||
| $remote_address = null; | |||||
| } | } | ||||
| $event_id = $log->getPushEvent()->getID(); | $event_id = $log->getPushEvent()->getID(); | ||||
| $old_ref_link = null; | $old_ref_link = null; | ||||
| if ($log->getRefOld() != DiffusionCommitHookEngine::EMPTY_HASH) { | if ($log->getRefOld() != DiffusionCommitHookEngine::EMPTY_HASH) { | ||||
| $old_ref_link = phutil_tag( | $old_ref_link = phutil_tag( | ||||
| 'a', | 'a', | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | $table = id(new AphrontTableView($rows)) | ||||
| 'n', | 'n', | ||||
| 'right', | 'right', | ||||
| )) | )) | ||||
| ->setColumnVisibility( | ->setColumnVisibility( | ||||
| array( | array( | ||||
| true, | true, | ||||
| true, | true, | ||||
| true, | true, | ||||
| true, | $remotes_visible, | ||||
| true, | true, | ||||
| $any_host, | $any_host, | ||||
| )); | )); | ||||
| return $table; | return $table; | ||||
| } | } | ||||
| } | } | ||||