3 final class DifferentialChangeDetailMailView
4 extends DifferentialMailView
{
10 public function setViewer(PhabricatorUser
$viewer) {
11 $this->viewer
= $viewer;
15 public function getViewer() {
19 public function setDiff(DifferentialDiff
$diff) {
24 public function getDiff() {
28 public function setPatch($patch) {
29 $this->patch
= $patch;
33 public function getPatch() {
37 public function buildMailSection() {
38 $viewer = $this->getViewer();
40 $diff = $this->getDiff();
42 $engine = new PhabricatorMarkupEngine();
43 $viewstate = new PhabricatorChangesetViewState();
46 foreach ($diff->getChangesets() as $changeset) {
47 $parser = id(new DifferentialChangesetParser())
49 ->setViewState($viewstate)
50 ->setChangeset($changeset)
51 ->setLinesOfContext(2)
52 ->setMarkupEngine($engine);
54 $parser->setRenderer(new DifferentialChangesetOneUpMailRenderer());
55 $block = $parser->render();
57 $filename = $changeset->getFilename();
58 $filename = $this->renderHeaderBold($filename);
59 $header = $this->renderHeaderBlock($filename);
61 $out[] = $this->renderContentBox(
64 $this->renderCodeBlock($block),
68 $out = phutil_implode_html(phutil_tag('br'), $out);
72 $patch_text = $this->getPatch();
74 return id(new PhabricatorMetaMTAMailSection())
75 ->addPlaintextFragment($patch_text)
76 ->addHTMLFragment($patch_html);