1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Reduce some code duplication in PhortuneLandingController

Summary: Ref T12451. This code is the same as the other code.

Test Plan: Went through the default-account case with this code, worked the same as the other code.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12451

Differential Revision: https://secure.phabricator.com/D17693
This commit is contained in:
epriestley 2017-04-14 09:59:43 -07:00
parent 505b1d8379
commit 7fbb5f2d92

View file

@ -5,17 +5,9 @@ final class PhortuneLandingController extends PhortuneController {
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer(); $viewer = $request->getViewer();
$accounts = id(new PhortuneAccountQuery()) $accounts = PhortuneAccountQuery::loadAccountsForUser(
->setViewer($viewer)
->withMemberPHIDs(array($viewer->getPHID()))
->execute();
if (!$accounts) {
$account = PhortuneAccount::createNewAccount(
$viewer, $viewer,
PhabricatorContentSource::newFromRequest($request)); PhabricatorContentSource::newFromRequest($request));
$accounts = array($account);
}
if (count($accounts) == 1) { if (count($accounts) == 1) {
$account = head($accounts); $account = head($accounts);