1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

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
This commit is contained in:
epriestley 2019-08-08 10:13:41 -07:00
parent 937edcdc58
commit 46d9065bf1

View file

@ -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)