mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
a17542ab28
Summary: Ref T1460. Overall: - Pass `objectOwnerPHID` consistently. - Pass viewer consistently. - Set the correct draft state for checkboxes on the client. Test Plan: - Made inline comments in Differential. - Made inline comments in Diffusion. Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T1460 Differential Revision: https://secure.phabricator.com/D12186
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
abstract class PhabricatorInlineCommentPreviewController
|
|
extends PhabricatorController {
|
|
|
|
abstract protected function loadInlineComments();
|
|
abstract protected function loadObjectOwnerPHID();
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$viewer = $request->getUser();
|
|
|
|
$inlines = $this->loadInlineComments();
|
|
assert_instances_of($inlines, 'PhabricatorInlineCommentInterface');
|
|
|
|
$engine = new PhabricatorMarkupEngine();
|
|
$engine->setViewer($viewer);
|
|
foreach ($inlines as $inline) {
|
|
$engine->addObject(
|
|
$inline,
|
|
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
|
|
}
|
|
$engine->process();
|
|
|
|
$phids = array($viewer->getPHID());
|
|
$handles = $this->loadViewerHandles($phids);
|
|
$object_owner_phid = $this->loadObjectOwnerPHID();
|
|
|
|
$views = array();
|
|
foreach ($inlines as $inline) {
|
|
$view = id(new PHUIDiffInlineCommentDetailView())
|
|
->setUser($viewer)
|
|
->setInlineComment($inline)
|
|
->setMarkupEngine($engine)
|
|
->setHandles($handles)
|
|
->setEditable(false)
|
|
->setPreview(true)
|
|
->setCanMarkDone(false)
|
|
->setObjectOwnerPHID($object_owner_phid);
|
|
$views[] = $view->render();
|
|
}
|
|
$views = phutil_implode_html("\n", $views);
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
->setContent($views);
|
|
}
|
|
}
|