Page MenuHomePhabricator

Badges tab on profile pages may overheat if user can not edit the first 10 badges
Closed, ResolvedPublic

Description

See https://discourse.phabricator-community.org/t/unhandled-exception-when-accessing-badges/3010/.

The "Badges" tab on user profiles may overheat explosively.

This specifically appears to be arising from this unusual query:

$badges = id(new PhabricatorBadgesQuery())
  ->setViewer($viewer)
  ->withStatuses(array(
    PhabricatorBadgesBadge::STATUS_ACTIVE,
  ))
  ->requireCapabilities(
    array(
      PhabricatorPolicyCapability::CAN_VIEW,
      PhabricatorPolicyCapability::CAN_EDIT,
    ))
  ->setLimit(1)
  ->execute();

We're using this to implement a behavior: if the user can't award any badges, don't show the "Award Badge" button.

This behavior is not consistent with how the rest of the UI works and can not be queried efficiently in the general case, so I'm just going to drop it.

Event Timeline

epriestley triaged this task as Low priority.Thu, Aug 8, 5:11 PM
epriestley created this task.

The repro case is something like:

  • Create 12 badges.
  • As user Alice, who can not edit any of the badges, view a "Badge" tab on a user profile.