From 08b18ac5f5b47fe96741aaad944f85ba0e72e03f Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 1 Mar 2017 19:06:54 -0800 Subject: [PATCH] Remove needBadges from PhabricatorUser Summary: Ref T12270. We don't really need these, timeline does it's own thing, badges is now a profile page, and hovercards have been removed. Test Plan: Visit timeline, still see badges, visit my profile page, bask in the warmth of fake awards. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12270 Differential Revision: https://secure.phabricator.com/D17448 --- ...abricatorPeopleProfileBadgesController.php | 25 ++++++++----------- .../people/query/PhabricatorPeopleQuery.php | 21 ---------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php b/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php index 1b22452430..73e5459cda 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php @@ -13,7 +13,6 @@ final class PhabricatorPeopleProfileBadgesController ->needProfile(true) ->needProfileImage(true) ->needAvailability(true) - ->needBadges(true) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -82,21 +81,17 @@ final class PhabricatorPeopleProfileBadgesController private function buildBadgesView(PhabricatorUser $user) { $viewer = $this->getViewer(); - $awards = array(); - $badges = array(); - if ($user->getBadgePHIDs()) { - $awards = id(new PhabricatorBadgesAwardQuery()) - ->setViewer($viewer) - ->withRecipientPHIDs(array($user->getPHID())) - ->execute(); - $awards = mpull($awards, null, 'getBadgePHID'); + $awards = id(new PhabricatorBadgesAwardQuery()) + ->setViewer($viewer) + ->withRecipientPHIDs(array($user->getPHID())) + ->execute(); + $awards = mpull($awards, null, 'getBadgePHID'); - $badges = array(); - foreach ($awards as $award) { - $badge = $award->getBadge(); - if ($badge->getStatus() == PhabricatorBadgesBadge::STATUS_ACTIVE) { - $badges[$award->getBadgePHID()] = $badge; - } + $badges = array(); + foreach ($awards as $award) { + $badge = $award->getBadge(); + if ($badge->getStatus() == PhabricatorBadgesBadge::STATUS_ACTIVE) { + $badges[$award->getBadgePHID()] = $badge; } } diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php index 3af1c4f167..b6791a7be2 100644 --- a/src/applications/people/query/PhabricatorPeopleQuery.php +++ b/src/applications/people/query/PhabricatorPeopleQuery.php @@ -23,7 +23,6 @@ final class PhabricatorPeopleQuery private $needProfile; private $needProfileImage; private $needAvailability; - private $needBadges; private $cacheKeys = array(); public function withIDs(array $ids) { @@ -128,11 +127,6 @@ final class PhabricatorPeopleQuery return $this; } - public function needBadges($need) { - $this->needBadges = $need; - return $this; - } - public function needUserSettings($need) { $cache_key = PhabricatorUserPreferencesCacheType::KEY_PREFERENCES; @@ -180,21 +174,6 @@ final class PhabricatorPeopleQuery } } - if ($this->needBadges) { - $awards = id(new PhabricatorBadgesAwardQuery()) - ->setViewer($this->getViewer()) - ->withRecipientPHIDs(mpull($users, 'getPHID')) - ->execute(); - - $awards = mgroup($awards, 'getRecipientPHID'); - - foreach ($users as $user) { - $user_awards = idx($awards, $user->getPHID(), array()); - $badge_phids = mpull($user_awards, 'getBadgePHID'); - $user->attachBadgePHIDs($badge_phids); - } - } - if ($this->needAvailability) { $rebuild = array(); foreach ($users as $user) {