mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Adding awarder info to badge cards displayed on user profile pages
Summary: Ref T8940 Test Plan: Award badge, open recipient profile page, badge should appear in badges list, and flipping the badge card should show who awarded it. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: chad, Korvin Maniphest Tasks: T8940 Differential Revision: https://secure.phabricator.com/D15570
This commit is contained in:
parent
839e7e2fc6
commit
219357aa9f
1 changed files with 32 additions and 10 deletions
|
@ -181,27 +181,49 @@ final class PhabricatorPeopleProfileViewController
|
|||
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) {
|
||||
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());
|
||||
->setQuality($badge->getQuality())
|
||||
->addByLine($awarder_info);
|
||||
|
||||
$flex->addItem($item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = id(new PHUIBoxView())
|
||||
->addClass('mlb')
|
||||
|
|
Loading…
Reference in a new issue