Differential D20719 Diff 49436 src/applications/phortune/controller/account/PhortuneAccountController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/account/PhortuneAccountController.php
Show All 17 Lines | final public function handleRequest(AphrontRequest $request) { | ||||
} | } | ||||
return $this->handleAccountRequest($request); | return $this->handleAccountRequest($request); | ||||
} | } | ||||
abstract protected function shouldRequireAccountEditCapability(); | abstract protected function shouldRequireAccountEditCapability(); | ||||
abstract protected function handleAccountRequest(AphrontRequest $request); | abstract protected function handleAccountRequest(AphrontRequest $request); | ||||
private function hasAccount() { | |||||
return (bool)$this->account; | |||||
} | |||||
final protected function getAccount() { | final protected function getAccount() { | ||||
if ($this->account === null) { | if ($this->account === null) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unable to "getAccount()" before loading or setting account '. | 'Unable to "getAccount()" before loading or setting account '. | ||||
'context.')); | 'context.')); | ||||
} | } | ||||
return $this->account; | return $this->account; | ||||
} | } | ||||
protected function buildApplicationCrumbs() { | protected function buildApplicationCrumbs() { | ||||
$crumbs = parent::buildApplicationCrumbs(); | $crumbs = parent::buildApplicationCrumbs(); | ||||
// If we hit a policy exception, we can make it here without finding | |||||
// an account. | |||||
if ($this->hasAccount()) { | |||||
$account = $this->getAccount(); | $account = $this->getAccount(); | ||||
if ($account) { | |||||
$crumbs->addTextCrumb($account->getName(), $account->getURI()); | $crumbs->addTextCrumb($account->getName(), $account->getURI()); | ||||
} | } | ||||
return $crumbs; | return $crumbs; | ||||
} | } | ||||
private function loadAccountForEdit() { | private function loadAccountForEdit() { | ||||
return $this->loadAccountWithCapabilities( | return $this->loadAccountWithCapabilities( | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |