mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 15:21:03 +01:00
Remove ManiphestLegacyTransactionQuery
Summary: Ref T2217. No remaining callsites. Also get rid of some methods on ManiphestTransaction that nothing calls anymore. Test Plan: `grep`, looked at tasks. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2217 Differential Revision: https://secure.phabricator.com/D7079
This commit is contained in:
parent
6919dddaab
commit
28e66090fd
3 changed files with 1 additions and 146 deletions
|
@ -706,7 +706,6 @@ phutil_register_library_map(array(
|
|||
'ManiphestExcelFormat' => 'applications/maniphest/export/ManiphestExcelFormat.php',
|
||||
'ManiphestExportController' => 'applications/maniphest/controller/ManiphestExportController.php',
|
||||
'ManiphestHovercardEventListener' => 'applications/maniphest/event/ManiphestHovercardEventListener.php',
|
||||
'ManiphestLegacyTransactionQuery' => 'applications/maniphest/query/ManiphestLegacyTransactionQuery.php',
|
||||
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
|
||||
'ManiphestNameIndexEventListener' => 'applications/maniphest/event/ManiphestNameIndexEventListener.php',
|
||||
'ManiphestPHIDTypeTask' => 'applications/maniphest/phid/ManiphestPHIDTypeTask.php',
|
||||
|
@ -2823,7 +2822,6 @@ phutil_register_library_map(array(
|
|||
'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'ManiphestTaskStatus' => 'ManiphestConstants',
|
||||
'ManiphestTaskSubscriber' => 'ManiphestDAO',
|
||||
'ManiphestTransaction' => 'PhabricatorMarkupInterface',
|
||||
'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||
'ManiphestTransactionEditor' => 'PhabricatorEditor',
|
||||
'ManiphestTransactionPreviewController' => 'ManiphestController',
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class ManiphestLegacyTransactionQuery {
|
||||
|
||||
public static function loadByTasks(
|
||||
PhabricatorUser $viewer,
|
||||
array $tasks) {
|
||||
|
||||
$xactions = id(new ManiphestTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(mpull($tasks, 'getPHID'))
|
||||
->needComments(true)
|
||||
->execute();
|
||||
|
||||
foreach ($xactions as $key => $xaction) {
|
||||
$xactions[$key] = ManiphestTransaction::newFromModernTransaction(
|
||||
$xaction);
|
||||
}
|
||||
|
||||
return $xactions;
|
||||
}
|
||||
|
||||
public static function loadByTask(
|
||||
PhabricatorUser $viewer,
|
||||
ManiphestTask $task) {
|
||||
|
||||
return self::loadByTasks($viewer, array($task));
|
||||
}
|
||||
|
||||
public static function loadByTransactionID(
|
||||
PhabricatorUser $viewer,
|
||||
$xaction_id) {
|
||||
|
||||
$xaction = id(new ManiphestTransactionPro())->load($xaction_id);
|
||||
if (!$xaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$xaction = id(new ManiphestTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($xaction->getPHID()))
|
||||
->needComments(true)
|
||||
->executeOne();
|
||||
|
||||
if ($xaction) {
|
||||
$xaction = ManiphestTransaction::newFromModernTransaction($xaction);
|
||||
}
|
||||
|
||||
return $xaction;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
final class ManiphestTransaction
|
||||
implements PhabricatorMarkupInterface {
|
||||
final class ManiphestTransaction {
|
||||
|
||||
const MARKUP_FIELD_BODY = 'markup:body';
|
||||
|
||||
|
@ -16,15 +15,6 @@ final class ManiphestTransaction
|
|||
$this->proxy = clone $this->proxy;
|
||||
}
|
||||
|
||||
public static function newFromModernTransaction(
|
||||
ManiphestTransactionPro $pro) {
|
||||
|
||||
$obj = new ManiphestTransaction();
|
||||
$obj->proxy = $pro;
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function getModernTransaction() {
|
||||
return $this->proxy;
|
||||
}
|
||||
|
@ -204,88 +194,8 @@ final class ManiphestTransaction
|
|||
return $phids;
|
||||
}
|
||||
|
||||
public function canGroupWith($target) {
|
||||
if ($target->getAuthorPHID() != $this->getAuthorPHID()) {
|
||||
return false;
|
||||
}
|
||||
if ($target->hasComments() && $this->hasComments()) {
|
||||
return false;
|
||||
}
|
||||
$ttime = $target->getDateCreated();
|
||||
$stime = $this->getDateCreated();
|
||||
if (abs($stime - $ttime) > 60) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($target->getTransactionType() == $this->getTransactionType()) {
|
||||
$aux_type = PhabricatorTransactions::TYPE_CUSTOMFIELD;
|
||||
if ($this->getTransactionType() == $aux_type) {
|
||||
$that_key = $target->getMetadataValue('customfield:key');
|
||||
$this_key = $this->getMetadataValue('customfield:key');
|
||||
if ($that_key == $this_key) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hasComments() {
|
||||
return (bool)strlen(trim($this->getComments()));
|
||||
}
|
||||
|
||||
|
||||
/* -( Markup Interface )--------------------------------------------------- */
|
||||
|
||||
|
||||
/**
|
||||
* @task markup
|
||||
*/
|
||||
public function getMarkupFieldKey($field) {
|
||||
if ($this->shouldUseMarkupCache($field)) {
|
||||
$id = $this->getID();
|
||||
} else {
|
||||
$id = PhabricatorHash::digest($this->getMarkupText($field));
|
||||
}
|
||||
return "maniphest:x:{$field}:{$id}";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @task markup
|
||||
*/
|
||||
public function getMarkupText($field) {
|
||||
return $this->getComments();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @task markup
|
||||
*/
|
||||
public function newMarkupEngine($field) {
|
||||
return PhabricatorMarkupEngine::newManiphestMarkupEngine();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @task markup
|
||||
*/
|
||||
public function didMarkupText(
|
||||
$field,
|
||||
$output,
|
||||
PhutilMarkupEngine $engine) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @task markup
|
||||
*/
|
||||
public function shouldUseMarkupCache($field) {
|
||||
return (bool)$this->getID();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue