From e66bf175050e2f7f9b6ec0dd626840c37d608b3f Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sat, 2 Apr 2016 18:51:23 -0700 Subject: [PATCH] Fixing the badges query, yet again Summary: Forgot a more efficient way to get badge from award Test Plan: Badges on user profiles should still show up with awarder handle on the back of the card Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15589 --- .../PhabricatorPeopleProfileViewController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 06a2f02950..f77933df90 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -190,13 +190,13 @@ final class PhabricatorPeopleProfileViewController ->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(); - $badges = mpull($badges, null, 'getPHID'); + $badges = array(); + foreach ($awards as $award) { + $badge = $award->getBadge(); + if ($badge->getStatus() == PhabricatorBadgesBadge::STATUS_ACTIVE) { + $badges[$award->getBadgePHID()] = $badge; + } + } } if (count($badges)) {