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:
@@ -7,6 +7,7 @@ final class PhabricatorRepositoryPushEventQuery
|
||||
private $phids;
|
||||
private $repositoryPHIDs;
|
||||
private $pusherPHIDs;
|
||||
private $needLogs;
|
||||
|
||||
public function withIDs(array $ids) {
|
||||
$this->ids = $ids;
|
||||
@@ -28,6 +29,11 @@ final class PhabricatorRepositoryPushEventQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function needLogs($need_logs) {
|
||||
$this->needLogs = $need_logs;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function loadPage() {
|
||||
$table = new PhabricatorRepositoryPushEvent();
|
||||
$conn_r = $table->establishConnection('r');
|
||||
@@ -63,6 +69,24 @@ final class PhabricatorRepositoryPushEventQuery
|
||||
return $events;
|
||||
}
|
||||
|
||||
public function didFilterPage(array $events) {
|
||||
$phids = mpull($events, 'getPHID');
|
||||
|
||||
if ($this->needLogs) {
|
||||
$logs = id(new PhabricatorRepositoryPushLogQuery())
|
||||
->setParentQuery($this)
|
||||
->setViewer($this->getViewer())
|
||||
->withPushEventPHIDs($phids)
|
||||
->execute();
|
||||
$logs = mgroup($logs, 'getPushEventPHID');
|
||||
foreach ($events as $key => $event) {
|
||||
$event_logs = idx($logs, $event->getPHID(), array());
|
||||
$event->attachLogs($event_logs);
|
||||
}
|
||||
}
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
|
||||
$where = array();
|
||||
|
||||
Reference in New Issue
Block a user