mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
8756d82cf6
Summary: I'm pretty sure that `@group` annotations are useless now... see D9855. Also fixed various other minor issues. Test Plan: Eye-ball it. Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin, hach-que Differential Revision: https://secure.phabricator.com/D9859
66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class PhabricatorSearchHovercardController
|
|
extends PhabricatorSearchBaseController {
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$user = $request->getUser();
|
|
|
|
$phids = $request->getArr('phids');
|
|
|
|
$handles = id(new PhabricatorHandleQuery())
|
|
->setViewer($user)
|
|
->withPHIDs($phids)
|
|
->execute();
|
|
$objects = id(new PhabricatorObjectQuery())
|
|
->setViewer($user)
|
|
->withPHIDs($phids)
|
|
->execute();
|
|
|
|
$cards = array();
|
|
|
|
foreach ($phids as $phid) {
|
|
$handle = $handles[$phid];
|
|
|
|
$hovercard = new PhabricatorHovercardView();
|
|
$hovercard->setObjectHandle($handle);
|
|
|
|
// Send it to the other side of the world, thanks to PhutilEventEngine
|
|
$event = new PhabricatorEvent(
|
|
PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD,
|
|
array(
|
|
'hovercard' => $hovercard,
|
|
'handle' => $handle,
|
|
'object' => idx($objects, $phid),
|
|
));
|
|
$event->setUser($user);
|
|
PhutilEventEngine::dispatchEvent($event);
|
|
|
|
$cards[$phid] = $hovercard;
|
|
}
|
|
|
|
// Browser-friendly for non-Ajax requests
|
|
if (!$request->isAjax()) {
|
|
foreach ($cards as $key => $hovercard) {
|
|
$cards[$key] = phutil_tag('div',
|
|
array(
|
|
'class' => 'ml',
|
|
),
|
|
$hovercard);
|
|
}
|
|
|
|
return $this->buildApplicationPage(
|
|
$cards,
|
|
array(
|
|
'device' => false,
|
|
));
|
|
} else {
|
|
return id(new AphrontAjaxResponse())->setContent(
|
|
array(
|
|
'cards' => $cards,
|
|
));
|
|
}
|
|
}
|
|
|
|
}
|