From 7fbb5f2d92108fd6beaef3bc099247943affb693 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 14 Apr 2017 09:59:43 -0700 Subject: [PATCH] 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 --- .../controller/PhortuneLandingController.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/applications/phortune/controller/PhortuneLandingController.php b/src/applications/phortune/controller/PhortuneLandingController.php index 2a019c5df9..e6906095d2 100644 --- a/src/applications/phortune/controller/PhortuneLandingController.php +++ b/src/applications/phortune/controller/PhortuneLandingController.php @@ -5,17 +5,9 @@ final class PhortuneLandingController extends PhortuneController { public function handleRequest(AphrontRequest $request) { $viewer = $request->getViewer(); - $accounts = id(new PhortuneAccountQuery()) - ->setViewer($viewer) - ->withMemberPHIDs(array($viewer->getPHID())) - ->execute(); - - if (!$accounts) { - $account = PhortuneAccount::createNewAccount( - $viewer, - PhabricatorContentSource::newFromRequest($request)); - $accounts = array($account); - } + $accounts = PhortuneAccountQuery::loadAccountsForUser( + $viewer, + PhabricatorContentSource::newFromRequest($request)); if (count($accounts) == 1) { $account = head($accounts);