Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13968076
D13703.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13703.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Oct 17 2024, 6:25 PM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710593
Default Alt Text
D13703.diff (1 KB)
Attached To
Mode
D13703: Add Badges to Hovercards
Attached
Detach File
Event Timeline
Log In to Comment