1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 04:31:13 +01:00

unbreak typeaheads for /owners/new

Summary:
D6057 introduced images in the typeahead results, but not all
projects return a valid result.  This silently broke /owners/new because
the exception "Call to a member function loadProfileImageURI() on a non-object"
is swallowed somewhere in the handler.

Test Plan: go to /owners/new and type something in the primary owner field

Reviewers: epriestley, nh, Afaque_Hussain

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D6245
This commit is contained in:
Wez Furlong 2013-06-20 08:49:20 -07:00
parent e2f0003ff9
commit 9a929508ee

View file

@ -206,12 +206,16 @@ final class PhabricatorTypeaheadCommonDatasourceController
->withStatus(PhabricatorProjectQuery::STATUS_OPEN) ->withStatus(PhabricatorProjectQuery::STATUS_OPEN)
->execute(); ->execute();
foreach ($projs as $proj) { foreach ($projs as $proj) {
$results[] = id(new PhabricatorTypeaheadResult()) $proj_result = id(new PhabricatorTypeaheadResult())
->setName($proj->getName()) ->setName($proj->getName())
->setDisplayType("Project") ->setDisplayType("Project")
->setURI('/project/view/'.$proj->getID().'/') ->setURI('/project/view/'.$proj->getID().'/')
->setImageURI($proj->loadProfile()->loadProfileImageURI())
->setPHID($proj->getPHID()); ->setPHID($proj->getPHID());
$prof = $proj->loadProfile();
if ($prof) {
$proj_result->setImageURI($prof->loadProfileImageURI());
}
$results[] = $proj_result;
} }
} }