1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Remove ManiphestTransaction

Summary: Ref T2217. The preview had the last callsite, nuke it.

Test Plan: Used preview. Grepped for `ManiphestTransaction(`, `ManiphestTransaction::`, `'ManiphestTransaction'`, `"ManiphestTransaction"`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2217

Differential Revision: https://secure.phabricator.com/D7092
This commit is contained in:
epriestley 2013-09-24 10:48:58 -07:00
parent 119c2b8cec
commit 5a4e4eb3fd
3 changed files with 6 additions and 208 deletions

View file

@ -731,7 +731,6 @@ phutil_register_library_map(array(
'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php', 'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php',
'ManiphestTaskStatus' => 'applications/maniphest/constants/ManiphestTaskStatus.php', 'ManiphestTaskStatus' => 'applications/maniphest/constants/ManiphestTaskStatus.php',
'ManiphestTaskSubscriber' => 'applications/maniphest/storage/ManiphestTaskSubscriber.php', 'ManiphestTaskSubscriber' => 'applications/maniphest/storage/ManiphestTaskSubscriber.php',
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php', 'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php',
'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php', 'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php',
'ManiphestTransactionEditorPro' => 'applications/maniphest/editor/ManiphestTransactionEditorPro.php', 'ManiphestTransactionEditorPro' => 'applications/maniphest/editor/ManiphestTransactionEditorPro.php',

View file

@ -31,13 +31,13 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
$action = $request->getStr('action'); $action = $request->getStr('action');
$transaction = new ManiphestTransaction(); $transaction = new ManiphestTransactionPro();
$transaction->setAuthorPHID($user->getPHID()); $transaction->setAuthorPHID($user->getPHID());
$transaction->setTransactionType($action); $transaction->setTransactionType($action);
// This should really be split into a separate transaction, but it should // This should really be split into a separate transaction, but it should
// all come out in the wash once we fully move to modern stuff. // all come out in the wash once we fully move to modern stuff.
$transaction->getModernTransaction()->attachComment( $transaction->attachComment(
id(new ManiphestTransactionComment()) id(new ManiphestTransactionComment())
->setContent($comments)); ->setContent($comments));
@ -106,18 +106,18 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
$engine = new PhabricatorMarkupEngine(); $engine = new PhabricatorMarkupEngine();
$engine->setViewer($user); $engine->setViewer($user);
if ($transaction->getModernTransaction()->hasComment()) { if ($transaction->hasComment()) {
$engine->addObject( $engine->addObject(
$transaction->getModernTransaction()->getComment(), $transaction->getComment(),
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
} }
$engine->process(); $engine->process();
$transaction->getModernTransaction()->setHandles($handles); $transaction->setHandles($handles);
$view = id(new PhabricatorApplicationTransactionView()) $view = id(new PhabricatorApplicationTransactionView())
->setUser($user) ->setUser($user)
->setTransactions(mpull($transactions, 'getModernTransaction')) ->setTransactions($transactions)
->setIsPreview(true) ->setIsPreview(true)
->setIsDetailView(true); ->setIsDetailView(true);

View file

@ -1,201 +0,0 @@
<?php
final class ManiphestTransaction {
const MARKUP_FIELD_BODY = 'markup:body';
private $proxy;
private $pendingComment;
public function __construct() {
$this->proxy = new ManiphestTransactionPro();
}
public function __clone() {
$this->proxy = clone $this->proxy;
}
public function getModernTransaction() {
return $this->proxy;
}
public function save() {
$this->proxy->openTransaction();
$this->proxy
->setViewPolicy('public')
->setEditPolicy($this->getAuthorPHID())
->save();
if ($this->pendingComment) {
$comment = id(new ManiphestTransactionComment())
->setTransactionPHID($this->proxy->getPHID())
->setCommentVersion(1)
->setAuthorPHID($this->getAuthorPHID())
->setViewPolicy('public')
->setEditPolicy($this->getAuthorPHID())
->setContent($this->pendingComment)
->setContentSource($this->getContentSource())
->setIsDeleted(0)
->save();
$this->proxy
->setCommentVersion(1)
->setCommentPHID($comment->getPHID())
->save();
$this->proxy->attachComment($comment);
$this->pendingComment = null;
}
$this->proxy->saveTransaction();
return $this;
}
public function setTransactionTask(ManiphestTask $task) {
$this->proxy->setObjectPHID($task->getPHID());
return $this;
}
public function getTaskPHID() {
return $this->proxy->getObjectPHID();
}
public function getID() {
return $this->proxy->getID();
}
public function setTaskID() {
throw new Exception("No longer supported!");
}
public function getTaskID() {
throw new Exception("No longer supported!");
}
public function getAuthorPHID() {
return $this->proxy->getAuthorPHID();
}
public function setAuthorPHID($phid) {
$this->proxy->setAuthorPHID($phid);
return $this;
}
public function getOldValue() {
return $this->proxy->getOldValue();
}
public function setOldValue($value) {
$this->proxy->setOldValue($value);
return $this;
}
public function getNewValue() {
return $this->proxy->getNewValue();
}
public function setNewValue($value) {
$this->proxy->setNewValue($value);
return $this;
}
public function getTransactionType() {
return $this->proxy->getTransactionType();
}
public function setTransactionType($value) {
$this->proxy->setTransactionType($value);
return $this;
}
public function setContentSource(PhabricatorContentSource $content_source) {
$this->proxy->setContentSource($content_source);
return $this;
}
public function getContentSource() {
return $this->proxy->getContentSource();
}
public function getMetadataValue($key, $default = null) {
return $this->proxy->getMetadataValue($key, $default);
}
public function setMetadataValue($key, $value) {
$this->proxy->setMetadataValue($key, $value);
return $this;
}
public function getComments() {
if ($this->pendingComment) {
return $this->pendingComment;
}
if ($this->proxy->getComment()) {
return $this->proxy->getComment()->getContent();
}
return null;
}
public function setComments($comment) {
$this->pendingComment = $comment;
return $this;
}
public function getDateCreated() {
return $this->proxy->getDateCreated();
}
public function getDateModified() {
return $this->proxy->getDateModified();
}
public function extractPHIDs() {
$phids = array();
switch ($this->getTransactionType()) {
case ManiphestTransactionType::TYPE_CCS:
case ManiphestTransactionType::TYPE_PROJECTS:
foreach ($this->getOldValue() as $phid) {
$phids[] = $phid;
}
foreach ($this->getNewValue() as $phid) {
$phids[] = $phid;
}
break;
case ManiphestTransactionType::TYPE_OWNER:
$phids[] = $this->getOldValue();
$phids[] = $this->getNewValue();
break;
case ManiphestTransactionType::TYPE_EDGE:
$phids = array_merge(
$phids,
array_keys($this->getOldValue() + $this->getNewValue()));
break;
case ManiphestTransactionType::TYPE_ATTACH:
$old = $this->getOldValue();
$new = $this->getNewValue();
if (!is_array($old)) {
$old = array();
}
if (!is_array($new)) {
$new = array();
}
$val = array_merge(array_values($old), array_values($new));
foreach ($val as $stuff) {
foreach ($stuff as $phid => $ignored) {
$phids[] = $phid;
}
}
break;
}
$phids[] = $this->getAuthorPHID();
return $phids;
}
public function hasComments() {
return (bool)strlen(trim($this->getComments()));
}
}