mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Un-implement MarkupInterface from Mocks and Images in Pholio
Summary: Depends on D19911. Ref T11351. `MarkupInterface` has mostly been replaced with `PHUIRemarkupView`, and isn't really doing anything for us here. Get rid of it to simplify the code. Test Plan: Viewed various mocks with descriptions and image descriptions, saw remarkup presented properly. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T11351 Differential Revision: https://secure.phabricator.com/D19912
This commit is contained in:
parent
1d84b5b86b
commit
c4c5d8a210
5 changed files with 4 additions and 87 deletions
|
@ -10946,7 +10946,6 @@ phutil_register_library_map(array(
|
|||
'PholioDefaultViewCapability' => 'PhabricatorPolicyCapability',
|
||||
'PholioImage' => array(
|
||||
'PholioDAO',
|
||||
'PhabricatorMarkupInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
),
|
||||
'PholioImageDescriptionTransaction' => 'PholioImageTransactionType',
|
||||
|
@ -10962,7 +10961,6 @@ phutil_register_library_map(array(
|
|||
'PholioInlineListController' => 'PholioController',
|
||||
'PholioMock' => array(
|
||||
'PholioDAO',
|
||||
'PhabricatorMarkupInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
'PhabricatorSubscribableInterface',
|
||||
'PhabricatorTokenReceiverInterface',
|
||||
|
|
|
@ -37,10 +37,6 @@ final class PholioMockViewController extends PholioController {
|
|||
PholioMockHasTaskEdgeType::EDGECONST);
|
||||
$this->setManiphestTaskPHIDs($phids);
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($viewer);
|
||||
$engine->addObject($mock, PholioMock::MARKUP_FIELD_DESCRIPTION);
|
||||
|
||||
$title = $mock->getName();
|
||||
|
||||
if ($mock->isClosed()) {
|
||||
|
@ -62,8 +58,7 @@ final class PholioMockViewController extends PholioController {
|
|||
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$mock,
|
||||
new PholioTransactionQuery(),
|
||||
$engine);
|
||||
new PholioTransactionQuery());
|
||||
$timeline->setMock($mock);
|
||||
|
||||
$curtain = $this->buildCurtainView($mock);
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
final class PholioImage extends PholioDAO
|
||||
implements
|
||||
PhabricatorMarkupInterface,
|
||||
PhabricatorPolicyInterface {
|
||||
|
||||
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
|
||||
|
||||
protected $mockID;
|
||||
protected $filePHID;
|
||||
protected $name;
|
||||
|
@ -86,32 +83,9 @@ final class PholioImage extends PholioDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorMarkupInterface )----------------------------------------- */
|
||||
|
||||
|
||||
public function getMarkupFieldKey($field) {
|
||||
$content = $this->getMarkupText($field);
|
||||
return PhabricatorMarkupEngine::digestRemarkupContent($this, $content);
|
||||
}
|
||||
|
||||
public function newMarkupEngine($field) {
|
||||
return PhabricatorMarkupEngine::newMarkupEngine(array());
|
||||
}
|
||||
|
||||
public function getMarkupText($field) {
|
||||
return $this->getDescription();
|
||||
}
|
||||
|
||||
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function shouldUseMarkupCache($field) {
|
||||
return (bool)$this->getID();
|
||||
}
|
||||
|
||||
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */
|
||||
|
||||
|
||||
public function getCapabilities() {
|
||||
return $this->getMock()->getCapabilities();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
final class PholioMock extends PholioDAO
|
||||
implements
|
||||
PhabricatorMarkupInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorSubscribableInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
|
@ -15,8 +14,6 @@ final class PholioMock extends PholioDAO
|
|||
PhabricatorFulltextInterface,
|
||||
PhabricatorFerretInterface {
|
||||
|
||||
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
|
||||
|
||||
const STATUS_OPEN = 'open';
|
||||
const STATUS_CLOSED = 'closed';
|
||||
|
||||
|
@ -216,41 +213,6 @@ final class PholioMock extends PholioDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorMarkupInterface )----------------------------------------- */
|
||||
|
||||
|
||||
public function getMarkupFieldKey($field) {
|
||||
$content = $this->getMarkupText($field);
|
||||
return PhabricatorMarkupEngine::digestRemarkupContent($this, $content);
|
||||
}
|
||||
|
||||
public function newMarkupEngine($field) {
|
||||
return PhabricatorMarkupEngine::newMarkupEngine(array());
|
||||
}
|
||||
|
||||
public function getMarkupText($field) {
|
||||
if ($this->getDescription()) {
|
||||
return $this->getDescription();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
||||
require_celerity_resource('phabricator-remarkup-css');
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-remarkup',
|
||||
),
|
||||
$output);
|
||||
}
|
||||
|
||||
public function shouldUseMarkupCache($field) {
|
||||
return (bool)$this->getID();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -72,13 +72,6 @@ final class PholioMockImagesView extends AphrontView {
|
|||
|
||||
$default = PhabricatorFile::loadBuiltin($viewer, 'image-100x100.png');
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($this->getUser());
|
||||
foreach ($mock->getAllImages() as $image) {
|
||||
$engine->addObject($image, 'default');
|
||||
}
|
||||
$engine->process();
|
||||
|
||||
$images = array();
|
||||
$current_set = 0;
|
||||
foreach ($mock->getAllImages() as $image) {
|
||||
|
@ -92,14 +85,9 @@ final class PholioMockImagesView extends AphrontView {
|
|||
$current_set++;
|
||||
}
|
||||
|
||||
$description = $engine->getOutput($image, 'default');
|
||||
$description = $image->getDescription();
|
||||
if (strlen($description)) {
|
||||
$description = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-remarkup',
|
||||
),
|
||||
$description);
|
||||
$description = new PHUIRemarkupView($viewer, $description);
|
||||
}
|
||||
|
||||
$history_uri = '/pholio/image/history/'.$image->getID().'/';
|
||||
|
|
Loading…
Reference in a new issue