mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 23:32:40 +01:00
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:
parent
e05d023753
commit
3fd16a9ba5
2 changed files with 39 additions and 20 deletions
|
@ -526,4 +526,39 @@ abstract class PhabricatorController extends AphrontController {
|
||||||
->setSubmitURI($submit_uri);
|
->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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,6 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
->executeOne();
|
->executeOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactions = id(new ManiphestTransactionQuery())
|
|
||||||
->setViewer($user)
|
|
||||||
->withObjectPHIDs(array($task->getPHID()))
|
|
||||||
->needComments(true)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
$field_list = PhabricatorCustomField::getObjectFields(
|
$field_list = PhabricatorCustomField::getObjectFields(
|
||||||
$task,
|
$task,
|
||||||
PhabricatorCustomField::ROLE_VIEW);
|
PhabricatorCustomField::ROLE_VIEW);
|
||||||
|
@ -136,15 +130,11 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
$engine = new PhabricatorMarkupEngine();
|
$engine = new PhabricatorMarkupEngine();
|
||||||
$engine->setViewer($user);
|
$engine->setViewer($user);
|
||||||
$engine->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
|
$engine->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
|
||||||
foreach ($transactions as $modern_xaction) {
|
|
||||||
if ($modern_xaction->getComment()) {
|
|
||||||
$engine->addObject(
|
|
||||||
$modern_xaction->getComment(),
|
|
||||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$engine->process();
|
$timeline = $this->buildTransactionTimeline(
|
||||||
|
$task,
|
||||||
|
new ManiphestTransactionQuery(),
|
||||||
|
$engine);
|
||||||
|
|
||||||
$resolution_types = ManiphestTaskStatus::getTaskStatusMap();
|
$resolution_types = ManiphestTaskStatus::getTaskStatusMap();
|
||||||
|
|
||||||
|
@ -337,12 +327,6 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
||||||
'aphront-panel-preview-loading-text',
|
'aphront-panel-preview-loading-text',
|
||||||
pht('Loading preview...'))));
|
pht('Loading preview...'))));
|
||||||
|
|
||||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
|
||||||
->setUser($user)
|
|
||||||
->setObjectPHID($task->getPHID())
|
|
||||||
->setTransactions($transactions)
|
|
||||||
->setMarkupEngine($engine);
|
|
||||||
|
|
||||||
$object_name = 'T'.$task->getID();
|
$object_name = 'T'.$task->getID();
|
||||||
$actions = $this->buildActionView($task);
|
$actions = $this->buildActionView($task);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue