Transactions - introduce a buildTransactionTimeline function
Summary: ...way way down in PhabricatorController. Use it on ManiphestTaskDetailController to test it. Ref T4712. I think the pager logic to be added as part of T4712 can safely reside entirely within this method. As I said earlier, 5 parameters is a lot, so I don't really want to add more. Next diff would do the pagination logic and the diff after that would deploy it everywhere. If while deploying it everywhere I find something off, that will be a different diff. Test Plan: viewed maniphest tasks and they looked as spiffy as ever. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T4712 Differential Revision: https://secure.phabricator.com/D10844
This commit is contained in:
@@ -526,4 +526,39 @@ abstract class PhabricatorController extends AphrontController {
|
||||
->setSubmitURI($submit_uri);
|
||||
}
|
||||
|
||||
protected function buildTransactionTimeline(
|
||||
PhabricatorLiskDAO $object,
|
||||
PhabricatorApplicationTransactionQuery $query,
|
||||
PhabricatorMarkupEngine $engine = null) {
|
||||
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
$xaction = $object->getApplicationTransactionTemplate();
|
||||
$view = $xaction->getApplicationTransactionViewObject();
|
||||
|
||||
$xactions = $query
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($object->getPHID()))
|
||||
->needComments(true)
|
||||
->execute();
|
||||
|
||||
if ($engine) {
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($xaction->getComment()) {
|
||||
$engine->addObject(
|
||||
$xaction->getComment(),
|
||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||
}
|
||||
}
|
||||
$engine->process();
|
||||
$view->setMarkupEngine($engine);
|
||||
}
|
||||
|
||||
$timeline = $view
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($object->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
return $timeline;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user