Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14834003
D15570.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D15570.diff
View Options
diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
@@ -181,26 +181,48 @@
return null;
}
- $badge_phids = $user->getBadgePHIDs();
- if ($badge_phids) {
+ $awards = array();
+ $badges = array();
+ if ($user->getBadgePHIDs()) {
+ $awards = id(new PhabricatorBadgesAwardQuery())
+ ->setViewer($viewer)
+ ->withRecipientPHIDs(array($user->getPHID()))
+ ->execute();
+ $awards = mpull($awards, null, 'getBadgePHID');
+
+ $badge_phids = mpull($awards, 'getBadgePHID');
$badges = id(new PhabricatorBadgesQuery())
->setViewer($viewer)
->withPHIDs($badge_phids)
->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE))
->execute();
- } else {
- $badges = array();
+ $badges = mpull($badges, null, 'getPHID');
}
if (count($badges)) {
$flex = new PHUIBadgeBoxView();
+
foreach ($badges as $badge) {
- $item = id(new PHUIBadgeView())
- ->setIcon($badge->getIcon())
- ->setHeader($badge->getName())
- ->setSubhead($badge->getFlavor())
- ->setQuality($badge->getQuality());
- $flex->addItem($item);
+ if ($badge) {
+ $awarder_info = array();
+
+ $award = idx($awards, $badge->getPHID(), null);
+ $awarder_phid = $award->getAwarderPHID();
+ $awarder_handle = $viewer->renderHandle($awarder_phid);
+
+ $awarder_info = pht(
+ 'Awarded by %s',
+ $awarder_handle->render());
+
+ $item = id(new PHUIBadgeView())
+ ->setIcon($badge->getIcon())
+ ->setHeader($badge->getName())
+ ->setSubhead($badge->getFlavor())
+ ->setQuality($badge->getQuality())
+ ->addByLine($awarder_info);
+
+ $flex->addItem($item);
+ }
}
} else {
$error = id(new PHUIBoxView())
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 1:23 PM (12 h, 59 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7078627
Default Alt Text
D15570.diff (2 KB)
Attached To
Mode
D15570: Adding awarder info to badge cards displayed on user profile pages
Attached
Detach File
Event Timeline
Log In to Comment