From 5a4e4eb3fdc336b6a7278e1e742bd440ec6c3d6b Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 24 Sep 2013 10:48:58 -0700 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 1 - .../ManiphestTransactionPreviewController.php | 12 +- .../storage/ManiphestTransaction.php | 201 ------------------ 3 files changed, 6 insertions(+), 208 deletions(-) delete mode 100644 src/applications/maniphest/storage/ManiphestTransaction.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index aa5ffffb08..5f8ab6c1d3 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -731,7 +731,6 @@ phutil_register_library_map(array( 'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php', 'ManiphestTaskStatus' => 'applications/maniphest/constants/ManiphestTaskStatus.php', 'ManiphestTaskSubscriber' => 'applications/maniphest/storage/ManiphestTaskSubscriber.php', - 'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php', 'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php', 'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php', 'ManiphestTransactionEditorPro' => 'applications/maniphest/editor/ManiphestTransactionEditorPro.php', diff --git a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php index 2f20c70c84..8bcdb1bc0b 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php @@ -31,13 +31,13 @@ final class ManiphestTransactionPreviewController extends ManiphestController { $action = $request->getStr('action'); - $transaction = new ManiphestTransaction(); + $transaction = new ManiphestTransactionPro(); $transaction->setAuthorPHID($user->getPHID()); $transaction->setTransactionType($action); // 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. - $transaction->getModernTransaction()->attachComment( + $transaction->attachComment( id(new ManiphestTransactionComment()) ->setContent($comments)); @@ -106,18 +106,18 @@ final class ManiphestTransactionPreviewController extends ManiphestController { $engine = new PhabricatorMarkupEngine(); $engine->setViewer($user); - if ($transaction->getModernTransaction()->hasComment()) { + if ($transaction->hasComment()) { $engine->addObject( - $transaction->getModernTransaction()->getComment(), + $transaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); } $engine->process(); - $transaction->getModernTransaction()->setHandles($handles); + $transaction->setHandles($handles); $view = id(new PhabricatorApplicationTransactionView()) ->setUser($user) - ->setTransactions(mpull($transactions, 'getModernTransaction')) + ->setTransactions($transactions) ->setIsPreview(true) ->setIsDetailView(true); diff --git a/src/applications/maniphest/storage/ManiphestTransaction.php b/src/applications/maniphest/storage/ManiphestTransaction.php deleted file mode 100644 index 19cbcb6999..0000000000 --- a/src/applications/maniphest/storage/ManiphestTransaction.php +++ /dev/null @@ -1,201 +0,0 @@ -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())); - } - -}