Provide an "event" page for push logs, which shows details on all events in a given push
Summary:
Ref T4677. This shows a more detailed view of an entire "git push", "hg push", or "svn commit".
This is mostly to give push summary emails a reasonable, stable URI to link to for T4677.
Test Plan:
- Pushed into SVN, Git and Mercurial.
- Viewed partial and imported event records.
{F134864}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4677
Differential Revision: https://secure.phabricator.com/D8616
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
final class DiffusionPushLogListController extends DiffusionController
|
||||
final class DiffusionPushLogListController extends DiffusionPushLogController
|
||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
||||
|
||||
private $queryKey;
|
||||
@@ -26,101 +26,8 @@ final class DiffusionPushLogListController extends DiffusionController
|
||||
public function renderResultsList(
|
||||
array $logs,
|
||||
PhabricatorSavedQuery $query) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$this->loadHandles(mpull($logs, 'getPusherPHID'));
|
||||
|
||||
// Figure out which repositories are editable. We only let you see remote
|
||||
// IPs if you have edit capability on a repository.
|
||||
$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();
|
||||
foreach ($logs as $log) {
|
||||
|
||||
// Reveal this if it's valid and the user can edit the repository.
|
||||
$remote_addr = '-';
|
||||
if (isset($editable_repos[$log->getRepositoryPHID()])) {
|
||||
$remote_long = $log->getPushEvent()->getRemoteAddress();
|
||||
if ($remote_long) {
|
||||
$remote_addr = long2ip($remote_long);
|
||||
}
|
||||
}
|
||||
|
||||
$callsign = $log->getRepository()->getCallsign();
|
||||
$rows[] = array(
|
||||
$log->getPushEvent()->getID(),
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $this->getApplicationURI($callsign.'/'),
|
||||
),
|
||||
$callsign),
|
||||
$this->getHandle($log->getPusherPHID())->renderLink(),
|
||||
$remote_addr,
|
||||
$log->getPushEvent()->getRemoteProtocol(),
|
||||
$log->getRefType(),
|
||||
$log->getRefName(),
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/r'.$callsign.$log->getRefOld(),
|
||||
),
|
||||
$log->getRefOldShort()),
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/r'.$callsign.$log->getRefNew(),
|
||||
),
|
||||
$log->getRefNewShort()),
|
||||
|
||||
// TODO: Make these human-readable.
|
||||
$log->getChangeFlags(),
|
||||
$log->getPushEvent()->getRejectCode(),
|
||||
phabricator_datetime($log->getEpoch(), $viewer),
|
||||
);
|
||||
}
|
||||
|
||||
$table = id(new AphrontTableView($rows))
|
||||
->setHeaders(
|
||||
array(
|
||||
pht('Push'),
|
||||
pht('Repository'),
|
||||
pht('Pusher'),
|
||||
pht('From'),
|
||||
pht('Via'),
|
||||
pht('Type'),
|
||||
pht('Name'),
|
||||
pht('Old'),
|
||||
pht('New'),
|
||||
pht('Flags'),
|
||||
pht('Code'),
|
||||
pht('Date'),
|
||||
))
|
||||
->setColumnClasses(
|
||||
array(
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'wide',
|
||||
'n',
|
||||
'n',
|
||||
'date',
|
||||
));
|
||||
$table = $this->renderPushLogTable($logs);
|
||||
|
||||
$box = id(new PHUIBoxView())
|
||||
->addMargin(PHUI::MARGIN_LARGE)
|
||||
|
||||
Reference in New Issue
Block a user