From 46d9065bf148496777b73c8f97dee989c1774ab0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 8 Aug 2019 10:13:41 -0700 Subject: [PATCH] Drop test for awardable badges on "Badges" tab of user profiles to avoid overheating Summary: Fixes T13370. We currently show an "Award Badge" button conditionally, based on whether the viewer can award any badges or not. The query to test this may overheat and this pattern isn't consistent with other UI anyway. Stop doing this test. Test Plan: - Created 12 badges. - As a user who could not edit any of the badges, viewed the "Badges" section of a user profile. Maniphest Tasks: T13370 Differential Revision: https://secure.phabricator.com/D20702 --- ...abricatorPeopleProfileBadgesController.php | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php b/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php index f98970ef73..e4861e488a 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php @@ -34,20 +34,6 @@ final class PhabricatorPeopleProfileBadgesController $user, PhabricatorPeopleProfileMenuEngine::ITEM_BADGES); - // Best option? - $badges = id(new PhabricatorBadgesQuery()) - ->setViewer($viewer) - ->withStatuses(array( - PhabricatorBadgesBadge::STATUS_ACTIVE, - )) - ->requireCapabilities( - array( - PhabricatorPolicyCapability::CAN_VIEW, - PhabricatorPolicyCapability::CAN_EDIT, - )) - ->setLimit(1) - ->execute(); - $button = id(new PHUIButtonView()) ->setTag('a') ->setIcon('fa-plus') @@ -55,17 +41,16 @@ final class PhabricatorPeopleProfileBadgesController ->setWorkflow(true) ->setHref('/badges/award/'.$user->getID().'/'); - if ($badges) { - $header->addActionLink($button); - } + $header->addActionLink($button); $view = id(new PHUITwoColumnView()) ->setHeader($header) ->addClass('project-view-home') ->addClass('project-view-people-home') - ->setFooter(array( - $this->buildBadgesView($user) - )); + ->setFooter( + array( + $badges, + )); return $this->newPage() ->setTitle($title)