Page MenuHomePhabricator

D13703.diff
No OneTemporary

D13703.diff

diff --git a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php
--- a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php
+++ b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php
@@ -32,6 +32,7 @@
->withIDs(array($user->getID()))
->needAvailability(true)
->needProfile(true)
+ ->needBadges(true)
->executeOne();
$hovercard->setTitle($user->getUsername());
@@ -65,8 +66,39 @@
->truncateString($profile->getBlurb()));
}
+ $badges = $this->buildBadges($user, $viewer);
+ foreach ($badges as $badge) {
+ $hovercard->addBadge($badge);
+ }
+
$event->setValue('hovercard', $hovercard);
}
+ private function buildBadges(
+ PhabricatorUser $user,
+ $viewer) {
+
+ $class = 'PhabricatorBadgesApplication';
+ $items = array();
+
+ if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
+ $badge_phids = $user->getBadgePHIDs();
+ if ($badge_phids) {
+ $badges = id(new PhabricatorBadgesQuery())
+ ->setViewer($viewer)
+ ->withPHIDs($badge_phids)
+ ->execute();
+
+ foreach ($badges as $badge) {
+ $items[] = id(new PHUIBadgeMiniView())
+ ->setIcon($badge->getIcon())
+ ->setHeader($badge->getName())
+ ->setQuality($badge->getQuality());
+ }
+ }
+ }
+ return $items;
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Oct 16 2024, 7:56 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710593
Default Alt Text
D13703.diff (1 KB)

Event Timeline