From 7fc7b89bb4519df636f6e22ba8df67033bd76476 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 13 Oct 2014 11:14:33 -0700 Subject: [PATCH] Remove some dead Phortune code Summary: Ref T2787. This stuff is now irrelevant and/or has no callsites. Test Plan: `grep`, poked around Reviewers: chad, btrahan Reviewed By: chad, btrahan Subscribers: epriestley Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D10684 --- src/__phutil_library_map__.php | 2 - .../PhabricatorPhortuneApplication.php | 1 - .../controller/PhortuneController.php | 6 -- .../PhortuneProductViewController.php | 5 -- .../PhortunePurchaseViewController.php | 58 ------------------- .../phortune/query/PhortuneAccountQuery.php | 18 ------ 6 files changed, 90 deletions(-) delete mode 100644 src/applications/phortune/controller/PhortunePurchaseViewController.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 61750b2245..1099b52152 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2627,7 +2627,6 @@ phutil_register_library_map(array( 'PhortunePurchase' => 'applications/phortune/storage/PhortunePurchase.php', 'PhortunePurchasePHIDType' => 'applications/phortune/phid/PhortunePurchasePHIDType.php', 'PhortunePurchaseQuery' => 'applications/phortune/query/PhortunePurchaseQuery.php', - 'PhortunePurchaseViewController' => 'applications/phortune/controller/PhortunePurchaseViewController.php', 'PhortuneSchemaSpec' => 'applications/phortune/storage/PhortuneSchemaSpec.php', 'PhortuneStripePaymentProvider' => 'applications/phortune/provider/PhortuneStripePaymentProvider.php', 'PhortuneTestPaymentProvider' => 'applications/phortune/provider/PhortuneTestPaymentProvider.php', @@ -5705,7 +5704,6 @@ phutil_register_library_map(array( ), 'PhortunePurchasePHIDType' => 'PhabricatorPHIDType', 'PhortunePurchaseQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhortunePurchaseViewController' => 'PhortuneController', 'PhortuneSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhortuneStripePaymentProvider' => 'PhortunePaymentProvider', 'PhortuneTestPaymentProvider' => 'PhortunePaymentProvider', diff --git a/src/applications/phortune/application/PhabricatorPhortuneApplication.php b/src/applications/phortune/application/PhabricatorPhortuneApplication.php index f3928d7a7a..2f6fb77b3c 100644 --- a/src/applications/phortune/application/PhabricatorPhortuneApplication.php +++ b/src/applications/phortune/application/PhabricatorPhortuneApplication.php @@ -39,7 +39,6 @@ final class PhabricatorPhortuneApplication extends PhabricatorApplication { 'card/' => array( 'new/' => 'PhortunePaymentMethodCreateController', ), - 'buy/(?P\d+)/' => 'PhortuneProductPurchaseController', ), 'card/(?P\d+)/' => array( 'edit/' => 'PhortunePaymentMethodEditController', diff --git a/src/applications/phortune/controller/PhortuneController.php b/src/applications/phortune/controller/PhortuneController.php index ae15fb495e..f433f78471 100644 --- a/src/applications/phortune/controller/PhortuneController.php +++ b/src/applications/phortune/controller/PhortuneController.php @@ -2,12 +2,6 @@ abstract class PhortuneController extends PhabricatorController { - protected function loadActiveAccount(PhabricatorUser $user) { - return PhortuneAccountQuery::loadActiveAccountForUser( - $user, - PhabricatorContentSource::newFromRequest($this->getRequest())); - } - protected function buildChargesTable(array $charges, $show_cart = true) { $request = $this->getRequest(); $viewer = $request->getUser(); diff --git a/src/applications/phortune/controller/PhortuneProductViewController.php b/src/applications/phortune/controller/PhortuneProductViewController.php index a62d802a56..584ba241f9 100644 --- a/src/applications/phortune/controller/PhortuneProductViewController.php +++ b/src/applications/phortune/controller/PhortuneProductViewController.php @@ -16,7 +16,6 @@ final class PhortuneProductViewController extends PhortuneController { ->setViewer($user) ->withIDs(array($this->productID)) ->executeOne(); - if (!$product) { return new Aphront404Response(); } @@ -26,11 +25,7 @@ final class PhortuneProductViewController extends PhortuneController { $header = id(new PHUIHeaderView()) ->setHeader($product->getProductName()); - $account = $this->loadActiveAccount($user); - $edit_uri = $this->getApplicationURI('product/edit/'.$product->getID().'/'); - $cart_uri = $this->getApplicationURI( - $account->getID().'/buy/'.$product->getID().'/'); $actions = id(new PhabricatorActionListView()) ->setUser($user) diff --git a/src/applications/phortune/controller/PhortunePurchaseViewController.php b/src/applications/phortune/controller/PhortunePurchaseViewController.php deleted file mode 100644 index 01a5f5c43a..0000000000 --- a/src/applications/phortune/controller/PhortunePurchaseViewController.php +++ /dev/null @@ -1,58 +0,0 @@ -purchaseID = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); - - $account = $this->loadActiveAccount($viewer); - - $purchase = id(new PhortunePurchaseQuery()) - ->setViewer($viewer) - ->withIDs(array($this->purchaseID)) - ->executeOne(); - if (!$purchase) { - return new Aphront404Response(); - } - $cart = $purchase->getCart(); - - $title = pht('Purchase: %s', $purchase->getFullDisplayName()); - - $header = id(new PHUIHeaderView()) - ->setHeader($purchase->getFullDisplayName()); - - $crumbs = $this->buildApplicationCrumbs(); - $this->addAccountCrumb($crumbs, $account); - $crumbs->addTextCrumb( - pht('Cart %d', $cart->getID()), - $this->getApplicationURI('cart/'.$cart->getID().'/')); - $crumbs->addTextCrumb( - pht('Purchase %d', $purchase->getID()), - $this->getApplicationURI('purchase/'.$purchase->getID().'/')); - - $properties = id(new PHUIPropertyListView()) - ->setUser($viewer) - ->addProperty(pht('Status'), $purchase->getStatus()); - - $object_box = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->addPropertyList($properties); - - return $this->buildApplicationPage( - array( - $crumbs, - $object_box, - ), - array( - 'title' => $title, - )); - } - -} diff --git a/src/applications/phortune/query/PhortuneAccountQuery.php b/src/applications/phortune/query/PhortuneAccountQuery.php index 51a07bc876..676badcb0c 100644 --- a/src/applications/phortune/query/PhortuneAccountQuery.php +++ b/src/applications/phortune/query/PhortuneAccountQuery.php @@ -27,24 +27,6 @@ final class PhortuneAccountQuery return $accounts; } - public static function loadActiveAccountForUser( - PhabricatorUser $user, - PhabricatorContentSource $content_source) { - - $accounts = id(new PhortuneAccountQuery()) - ->setViewer($user) - ->withMemberPHIDs(array($user->getPHID())) - ->execute(); - - if (!$accounts) { - return PhortuneAccount::createNewAccount($user, $content_source); - } else if (count($accounts) == 1) { - return head($accounts); - } else { - throw new Exception('TODO: No account selection yet.'); - } - } - public function withIDs(array $ids) { $this->ids = $ids; return $this;