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.

Revisions and Commits

Restricted Differential Revision

Event Timeline

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.
epriestley added a revision: Restricted Differential Revision.Aug 8 2019, 5:16 PM
epriestley closed this task as Resolved by committing Restricted Diffusion Commit.Aug 8 2019, 5:19 PM
epriestley added a commit: Restricted Diffusion Commit.