mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Remove ManiphestTaskDescriptionChangeController
Summary: Ref T2217. This showed the text diff when you updated the description of a task, but is now obsolete. Remove flags and methods related to rendering this pathway. Test Plan: Clicked the fancy new "Show Details" instead. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2217 Differential Revision: https://secure.phabricator.com/D7071
This commit is contained in:
parent
3ba3745d67
commit
781c11560f
4 changed files with 1 additions and 155 deletions
|
@ -718,7 +718,6 @@ phutil_register_library_map(array(
|
|||
'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php',
|
||||
'ManiphestSubscribeController' => 'applications/maniphest/controller/ManiphestSubscribeController.php',
|
||||
'ManiphestTask' => 'applications/maniphest/storage/ManiphestTask.php',
|
||||
'ManiphestTaskDescriptionChangeController' => 'applications/maniphest/controller/ManiphestTaskDescriptionChangeController.php',
|
||||
'ManiphestTaskDescriptionPreviewController' => 'applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php',
|
||||
'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php',
|
||||
'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php',
|
||||
|
@ -2808,7 +2807,6 @@ phutil_register_library_map(array(
|
|||
4 => 'PhrequentTrackableInterface',
|
||||
5 => 'PhabricatorCustomFieldInterface',
|
||||
),
|
||||
'ManiphestTaskDescriptionChangeController' => 'ManiphestController',
|
||||
'ManiphestTaskDescriptionPreviewController' => 'ManiphestController',
|
||||
'ManiphestTaskDetailController' => 'ManiphestController',
|
||||
'ManiphestTaskEditController' => 'ManiphestController',
|
||||
|
|
|
@ -56,8 +56,6 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
|
|||
'task/' => array(
|
||||
'create/' => 'ManiphestTaskEditController',
|
||||
'edit/(?P<id>[1-9]\d*)/' => 'ManiphestTaskEditController',
|
||||
'descriptionchange/(?:(?P<id>[1-9]\d*)/)?' =>
|
||||
'ManiphestTaskDescriptionChangeController',
|
||||
'descriptionpreview/' =>
|
||||
'PhabricatorMarkupPreviewController',
|
||||
),
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group maniphest
|
||||
*/
|
||||
final class ManiphestTaskDescriptionChangeController
|
||||
extends ManiphestController {
|
||||
|
||||
private $transactionID;
|
||||
|
||||
protected function setTransactionID($transaction_id) {
|
||||
$this->transactionID = $transaction_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTransactionID() {
|
||||
return $this->transactionID;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->setTransactionID(idx($data, 'id'));
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$is_show_more = false;
|
||||
if (!$this->getTransactionID()) {
|
||||
$this->setTransactionID($this->getRequest()->getStr('ref'));
|
||||
$is_show_more = true;
|
||||
}
|
||||
|
||||
$transaction_id = $this->getTransactionID();
|
||||
$transaction = ManiphestLegacyTransactionQuery::loadByTransactionID(
|
||||
$user,
|
||||
$transaction_id);
|
||||
if (!$transaction) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$transactions = array($transaction);
|
||||
|
||||
$phids = array();
|
||||
foreach ($transactions as $xaction) {
|
||||
foreach ($xaction->extractPHIDs() as $phid) {
|
||||
$phids[$phid] = $phid;
|
||||
}
|
||||
}
|
||||
$handles = $this->loadViewerHandles($phids);
|
||||
|
||||
$engine = new PhabricatorMarkupEngine();
|
||||
$engine->setViewer($user);
|
||||
$engine->addObject($transaction, ManiphestTransaction::MARKUP_FIELD_BODY);
|
||||
$engine->process();
|
||||
|
||||
$view = new ManiphestTransactionDetailView();
|
||||
$view->setTransactionGroup($transactions);
|
||||
$view->setHandles($handles);
|
||||
$view->setUser($user);
|
||||
$view->setMarkupEngine($engine);
|
||||
$view->setRenderSummaryOnly(true);
|
||||
$view->setRenderFullSummary(true);
|
||||
$view->setRangeSpecification($request->getStr('range'));
|
||||
|
||||
if ($is_show_more) {
|
||||
return id(new PhabricatorChangesetResponse())
|
||||
->setRenderedChangeset($view->render());
|
||||
} else {
|
||||
return id(new AphrontAjaxResponse())->setContent($view->render());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -11,10 +11,6 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||
private $forEmail;
|
||||
private $preview;
|
||||
private $commentNumber;
|
||||
private $rangeSpecification;
|
||||
|
||||
private $renderSummaryOnly;
|
||||
private $renderFullSummary;
|
||||
|
||||
private $auxiliaryFields;
|
||||
|
||||
|
@ -50,38 +46,11 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setRenderSummaryOnly($render_summary_only) {
|
||||
$this->renderSummaryOnly = $render_summary_only;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRenderSummaryOnly() {
|
||||
return $this->renderSummaryOnly;
|
||||
}
|
||||
|
||||
public function setRenderFullSummary($render_full_summary) {
|
||||
$this->renderFullSummary = $render_full_summary;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRenderFullSummary() {
|
||||
return $this->renderFullSummary;
|
||||
}
|
||||
|
||||
public function setCommentNumber($comment_number) {
|
||||
$this->commentNumber = $comment_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setRangeSpecification($range) {
|
||||
$this->rangeSpecification = $range;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRangeSpecification() {
|
||||
return $this->rangeSpecification;
|
||||
}
|
||||
|
||||
public function renderForEmail($with_date) {
|
||||
$this->forEmail = true;
|
||||
|
||||
|
@ -179,9 +148,6 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||
}
|
||||
$more_classes = array_merge($more_classes, $classes);
|
||||
$full_summary = null;
|
||||
if ($this->getRenderFullSummary()) {
|
||||
$full_summary = $this->renderFullSummary($transaction);
|
||||
}
|
||||
$descs[] = javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
|
@ -196,10 +162,6 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||
));
|
||||
}
|
||||
|
||||
if ($this->getRenderSummaryOnly()) {
|
||||
return phutil_implode_html("\n", $descs);
|
||||
}
|
||||
|
||||
if ($comment_transaction && $comment_transaction->hasComments()) {
|
||||
$comment_block = $this->markupEngine->getOutput(
|
||||
$comment_transaction,
|
||||
|
@ -335,12 +297,7 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||
break;
|
||||
case ManiphestTransactionType::TYPE_DESCRIPTION:
|
||||
$verb = 'Edited';
|
||||
if ($this->forEmail || $this->getRenderFullSummary()) {
|
||||
$desc = 'updated the task description';
|
||||
} else {
|
||||
$desc = 'updated the task description; '.
|
||||
$this->renderExpandLink($transaction);
|
||||
}
|
||||
$desc = 'updated the task description';
|
||||
break;
|
||||
case PhabricatorTransactions::TYPE_COMMENT:
|
||||
$verb = 'Commented On';
|
||||
|
@ -573,39 +530,6 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||
return array($verb, $desc, $classes, $full);
|
||||
}
|
||||
|
||||
private function renderFullSummary($transaction) {
|
||||
switch ($transaction->getTransactionType()) {
|
||||
case ManiphestTransactionType::TYPE_DESCRIPTION:
|
||||
$id = $transaction->getID();
|
||||
|
||||
$old_text = phutil_utf8_hard_wrap($transaction->getOldValue(), 80);
|
||||
$old_text = implode("\n", $old_text);
|
||||
$new_text = phutil_utf8_hard_wrap($transaction->getNewValue(), 80);
|
||||
$new_text = implode("\n", $new_text);
|
||||
|
||||
$engine = new PhabricatorDifferenceEngine();
|
||||
$changeset = $engine->generateChangesetFromFileContent($old_text,
|
||||
$new_text);
|
||||
|
||||
$whitespace_mode = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
|
||||
|
||||
$parser = new DifferentialChangesetParser();
|
||||
$parser->setChangeset($changeset);
|
||||
$parser->setRenderingReference($id);
|
||||
$parser->setMarkupEngine($this->markupEngine);
|
||||
$parser->setWhitespaceMode($whitespace_mode);
|
||||
|
||||
$spec = $this->getRangeSpecification();
|
||||
list($range_s, $range_e, $mask) =
|
||||
DifferentialChangesetParser::parseRangeSpecification($spec);
|
||||
$output = $parser->render($range_s, $range_e, $mask);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function renderExpandLink($transaction) {
|
||||
$id = $transaction->getID();
|
||||
|
||||
|
|
Loading…
Reference in a new issue