Differential D17694 Diff 42554 src/applications/phortune/controller/account/PhortuneAccountViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/account/PhortuneAccountViewController.php
| <?php | <?php | ||||
| final class PhortuneAccountViewController | final class PhortuneAccountViewController | ||||
| extends PhortuneAccountProfileController { | extends PhortuneAccountProfileController { | ||||
| public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
| $viewer = $this->getViewer(); | $response = $this->loadAccount(); | ||||
| $id = $request->getURIData('accountID'); | if ($response) { | ||||
| return $response; | |||||
| // TODO: Currently, you must be able to edit an account to view the detail | |||||
| // page, because the account must be broadly visible so merchants can | |||||
| // process orders but merchants should not be able to see all the details | |||||
| // of an account. Ideally this page should be visible to merchants, too, | |||||
| // just with less information. | |||||
| $can_edit = true; | |||||
| $account = id(new PhortuneAccountQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withIDs(array($id)) | |||||
| ->requireCapabilities( | |||||
| array( | |||||
| PhabricatorPolicyCapability::CAN_VIEW, | |||||
| PhabricatorPolicyCapability::CAN_EDIT, | |||||
| )) | |||||
| ->executeOne(); | |||||
| if (!$account) { | |||||
| return new Aphront404Response(); | |||||
| } | } | ||||
| $this->setAccount($account); | $account = $this->getAccount(); | ||||
| $title = $account->getName(); | $title = $account->getName(); | ||||
| $viewer = $this->getViewer(); | |||||
| $invoices = id(new PhortuneCartQuery()) | $invoices = id(new PhortuneCartQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withAccountPHIDs(array($account->getPHID())) | ->withAccountPHIDs(array($account->getPHID())) | ||||
| ->needPurchases(true) | ->needPurchases(true) | ||||
| ->withInvoices(true) | ->withInvoices(true) | ||||
| ->execute(); | ->execute(); | ||||
| $crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
| ▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines | |||||