mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 12:42:43 +01:00
0fd77783a4
Summary: Implements previews for Macros and Pholio. (Design is nonfinal -- kind of split the difference between `diff_full_view.png`, laziness, and space concerns. Next couple diffs will add more stuff here.) Test Plan: {F28055} Reviewers: btrahan, chad Reviewed By: btrahan CC: aran, vrana Maniphest Tasks: T2104 Differential Revision: https://secure.phabricator.com/D4246
73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorApplicationTransactionResponse
|
|
extends AphrontProxyResponse {
|
|
|
|
private $viewer;
|
|
private $transactions;
|
|
private $anchorOffset;
|
|
private $isPreview;
|
|
|
|
protected function buildProxy() {
|
|
return new AphrontAjaxResponse();
|
|
}
|
|
|
|
public function setAnchorOffset($anchor_offset) {
|
|
$this->anchorOffset = $anchor_offset;
|
|
return $this;
|
|
}
|
|
|
|
public function getAnchorOffset() {
|
|
return $this->anchorOffset;
|
|
}
|
|
|
|
public function setTransactions($transactions) {
|
|
assert_instances_of($transactions, 'PhabricatorApplicationTransaction');
|
|
|
|
$this->transactions = $transactions;
|
|
return $this;
|
|
}
|
|
|
|
public function getTransactions() {
|
|
return $this->transactions;
|
|
}
|
|
|
|
public function setViewer(PhabricatorUser $viewer) {
|
|
$this->viewer = $viewer;
|
|
return $this;
|
|
}
|
|
|
|
public function getViewer() {
|
|
return $this->viewer;
|
|
}
|
|
|
|
public function setIsPreview($is_preview) {
|
|
$this->isPreview = $is_preview;
|
|
return $this;
|
|
}
|
|
|
|
public function reduceProxyResponse() {
|
|
$view = id(new PhabricatorApplicationTransactionView())
|
|
->setUser($this->getViewer())
|
|
->setTransactions($this->getTransactions())
|
|
->setIsPreview($this->isPreview);
|
|
|
|
if ($this->getAnchorOffset()) {
|
|
$view->setAnchorOffset($this->getAnchorOffset());
|
|
}
|
|
|
|
if ($this->isPreview) {
|
|
$xactions = mpull($view->buildEvents(), 'render');
|
|
} else {
|
|
$xactions = mpull($view->buildEvents(), 'render', 'getTransactionPHID');
|
|
}
|
|
|
|
$content = array(
|
|
'xactions' => $xactions,
|
|
'spacer' => PhabricatorTimelineView::renderSpacer(),
|
|
);
|
|
|
|
return $this->getProxy()->setContent($content);
|
|
}
|
|
|
|
}
|