1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 19:02:41 +01:00
phorge-phorge/src/infrastructure/diff/PhabricatorInlineCommentPreviewController.php

43 lines
1.1 KiB
PHP
Raw Normal View History

<?php
abstract class PhabricatorInlineCommentPreviewController
extends PhabricatorController {
abstract protected function loadInlineComments();
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$inlines = $this->loadInlineComments();
assert_instances_of($inlines, 'PhabricatorInlineCommentInterface');
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($user);
foreach ($inlines as $inline) {
$engine->addObject(
$inline,
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
}
$engine->process();
$phids = array($user->getPHID());
$handles = $this->loadViewerHandles($phids);
$views = array();
foreach ($inlines as $inline) {
$view = new PHUIDiffInlineCommentDetailView();
$view->setInlineComment($inline);
$view->setMarkupEngine($engine);
$view->setHandles($handles);
$view->setEditable(false);
$view->setPreview(true);
$views[] = $view->render();
}
2013-02-13 23:50:15 +01:00
$views = phutil_implode_html("\n", $views);
return id(new AphrontAjaxResponse())
->setContent($views);
}
}