1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-11 08:06:13 +01:00
phorge-phorge/src/applications/transactions/controller/PhabricatorApplicationTransactionShowOlderController.php

56 lines
1.5 KiB
PHP
Raw Normal View History

<?php
final class PhabricatorApplicationTransactionShowOlderController
extends PhabricatorApplicationTransactionController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$viewer = $request->getUser();
$object = id(new PhabricatorObjectQuery())
->withPHIDs(array($request->getURIData('phid')))
->setViewer($viewer)
->executeOne();
if (!$object) {
return new Aphront404Response();
}
if (!$object instanceof PhabricatorApplicationTransactionInterface) {
return new Aphront404Response();
}
$template = $object->getApplicationTransactionTemplate();
$queries = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorApplicationTransactionQuery')
->loadObjects();
$object_query = null;
foreach ($queries as $query) {
if ($query->getTemplateApplicationTransaction() == $template) {
$object_query = $query;
break;
}
}
if (!$object_query) {
return new Aphront404Response();
}
$timeline = $this->buildTransactionTimeline(
$object,
$query);
$phui_timeline = $timeline->buildPHUITimelineView($with_hiding = false);
$phui_timeline->setShouldAddSpacers(false);
$events = $phui_timeline->buildEvents();
return id(new AphrontAjaxResponse())
->setContent(array(
'timeline' => hsprintf('%s', $events),));
}
}