Differential D17116 Diff 41173 src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php
| <?php | <?php | ||||
| final class PhabricatorApplicationTransactionResponse | final class PhabricatorApplicationTransactionResponse | ||||
| extends AphrontProxyResponse { | extends AphrontProxyResponse { | ||||
| private $viewer; | private $viewer; | ||||
| private $transactions; | private $transactions; | ||||
| private $isPreview; | private $isPreview; | ||||
| private $transactionView; | private $transactionView; | ||||
| private $previewContent; | |||||
| public function setTransactionView($transaction_view) { | public function setTransactionView($transaction_view) { | ||||
| $this->transactionView = $transaction_view; | $this->transactionView = $transaction_view; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getTransactionView() { | public function getTransactionView() { | ||||
| return $this->transactionView; | return $this->transactionView; | ||||
| Show All 23 Lines | public function getViewer() { | ||||
| return $this->viewer; | return $this->viewer; | ||||
| } | } | ||||
| public function setIsPreview($is_preview) { | public function setIsPreview($is_preview) { | ||||
| $this->isPreview = $is_preview; | $this->isPreview = $is_preview; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setPreviewContent($preview_content) { | |||||
| $this->previewContent = $preview_content; | |||||
| return $this; | |||||
| } | |||||
| public function getPreviewContent() { | |||||
| return $this->previewContent; | |||||
| } | |||||
| public function reduceProxyResponse() { | public function reduceProxyResponse() { | ||||
| if ($this->transactionView) { | if ($this->transactionView) { | ||||
| $view = $this->transactionView; | $view = $this->transactionView; | ||||
| } else if ($this->getTransactions()) { | } else if ($this->getTransactions()) { | ||||
| $view = head($this->getTransactions()) | $view = head($this->getTransactions()) | ||||
| ->getApplicationTransactionViewObject(); | ->getApplicationTransactionViewObject(); | ||||
| } else { | } else { | ||||
| $view = new PhabricatorApplicationTransactionView(); | $view = new PhabricatorApplicationTransactionView(); | ||||
| Show All 13 Lines | public function reduceProxyResponse() { | ||||
| // Force whatever the underlying views built to render into HTML for | // Force whatever the underlying views built to render into HTML for | ||||
| // the Javascript. | // the Javascript. | ||||
| foreach ($xactions as $key => $xaction) { | foreach ($xactions as $key => $xaction) { | ||||
| $xactions[$key] = hsprintf('%s', $xaction); | $xactions[$key] = hsprintf('%s', $xaction); | ||||
| } | } | ||||
| $content = array( | $content = array( | ||||
| 'xactions' => $xactions, | 'xactions' => $xactions, | ||||
| 'spacer' => PHUITimelineView::renderSpacer(), | 'spacer' => PHUITimelineView::renderSpacer(), | ||||
| 'previewContent' => hsprintf('%s', $this->getPreviewContent()), | |||||
| ); | ); | ||||
| return $this->getProxy()->setContent($content); | return $this->getProxy()->setContent($content); | ||||
| } | } | ||||
| } | } | ||||