Differential D17374 Diff 41784 src/applications/search/controller/PhabricatorSearchHovercardController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/controller/PhabricatorSearchHovercardController.php
| <?php | <?php | ||||
| final class PhabricatorSearchHovercardController | final class PhabricatorSearchHovercardController | ||||
| extends PhabricatorSearchBaseController { | extends PhabricatorSearchBaseController { | ||||
| public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $phids = $request->getArr('phids'); | $phids = $request->getStrList('phids'); | ||||
| // If object names are provided, look them up and pretend they were | |||||
| // passed as additional PHIDs. This is primarily useful for debugging, | |||||
| // since you don't have to go look up user PHIDs to preview their | |||||
| // hovercards. | |||||
| $names = $request->getStrList('names'); | |||||
| if ($names) { | |||||
| $named_objects = id(new PhabricatorObjectQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withNames($names) | |||||
| ->execute(); | |||||
| foreach ($named_objects as $object) { | |||||
| $phids[] = $object->getPHID(); | |||||
| } | |||||
| } | |||||
| $handles = id(new PhabricatorHandleQuery()) | $handles = id(new PhabricatorHandleQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withPHIDs($phids) | ->withPHIDs($phids) | ||||
| ->execute(); | ->execute(); | ||||
| $objects = id(new PhabricatorObjectQuery()) | $objects = id(new PhabricatorObjectQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||