Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / people / engineextension / PeopleHovercardEngineExtension.php
blob083a5f0ed1fcd0e338478a392807c3d0edd65aa5
1 <?php
3 final class PeopleHovercardEngineExtension
4 extends PhabricatorHovercardEngineExtension {
6 const EXTENSIONKEY = 'people';
8 public function isExtensionEnabled() {
9 return true;
12 public function getExtensionName() {
13 return pht('User Accounts');
16 public function canRenderObjectHovercard($object) {
17 return ($object instanceof PhabricatorUser);
20 public function willRenderHovercards(array $objects) {
21 $viewer = $this->getViewer();
22 $phids = mpull($objects, 'getPHID');
24 $users = id(new PhabricatorPeopleQuery())
25 ->setViewer($viewer)
26 ->withPHIDs($phids)
27 ->needAvailability(true)
28 ->needProfileImage(true)
29 ->needProfile(true)
30 ->execute();
31 $users = mpull($users, null, 'getPHID');
33 return array(
34 'users' => $users,
38 public function renderHovercard(
39 PHUIHovercardView $hovercard,
40 PhabricatorObjectHandle $handle,
41 $object,
42 $data) {
43 $viewer = $this->getViewer();
45 $user = idx($data['users'], $object->getPHID());
46 if (!$user) {
47 return;
50 $is_exiled = $hovercard->getIsExiled();
52 $user_card = id(new PhabricatorUserCardView())
53 ->setProfile($user)
54 ->setViewer($viewer)
55 ->setIsExiled($is_exiled);
57 $hovercard->appendChild($user_card);