1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 17:22:42 +01:00
phorge-phorge/src/infrastructure/diff/PhabricatorChangesetResponse.php
epriestley 56a9709008 Reduce code duplication for inline "Undo"
Summary:
Ref T2009. This is another almost-identical copy of the row scaffolding, which has the same 1up/2up bugs as the 8 other copies of this code.

Turn the "undo" element into an InlineCommentView so we can scaffold it.

Then, scaffold it with the same code as everything else.

Test Plan: Hit "Undo", swapped from 1up to 2up, hit "undo" again, swapped back, tried left/right, everything rendered with proper scaffolding.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D12019
2015-03-09 10:26:53 -07:00

44 lines
947 B
PHP

<?php
final class PhabricatorChangesetResponse extends AphrontProxyResponse {
private $renderedChangeset;
private $coverage;
private $undoTemplates;
public function setRenderedChangeset($rendered_changeset) {
$this->renderedChangeset = $rendered_changeset;
return $this;
}
public function setCoverage($coverage) {
$this->coverage = $coverage;
return $this;
}
public function setUndoTemplates($undo_templates) {
$this->undoTemplates = $undo_templates;
return $this;
}
protected function buildProxy() {
return new AphrontAjaxResponse();
}
public function reduceProxyResponse() {
$content = array(
'changeset' => $this->renderedChangeset,
);
if ($this->coverage) {
$content['coverage'] = $this->coverage;
}
if ($this->undoTemplates) {
$content['undoTemplates'] = $this->undoTemplates;
}
return $this->getProxy()->setContent($content);
}
}