@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix bad rendering pathway on user profiles for viewers without Badges application

Summary: Fixes T10275. We'd fatal on `$flex` not being defined.

Test Plan: Uninstalled badges, viewed profile. Before: fatal; now: no badges element appears but profile renders properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10275

Differential Revision: https://secure.phabricator.com/D15182

+27 -26
+27 -26
src/applications/people/controller/PhabricatorPeopleProfileViewController.php
··· 176 176 return $box; 177 177 } 178 178 179 - private function buildBadgesView( 180 - PhabricatorUser $user) { 179 + private function buildBadgesView(PhabricatorUser $user) { 181 180 182 181 $viewer = $this->getViewer(); 183 182 $class = 'PhabricatorBadgesApplication'; 184 183 185 - if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { 186 - $badge_phids = $user->getBadgePHIDs(); 187 - if ($badge_phids) { 188 - $badges = id(new PhabricatorBadgesQuery()) 189 - ->setViewer($viewer) 190 - ->withPHIDs($badge_phids) 191 - ->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE)) 192 - ->execute(); 184 + if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { 185 + return null; 186 + } 193 187 194 - $flex = new PHUIBadgeBoxView(); 195 - foreach ($badges as $badge) { 196 - $item = id(new PHUIBadgeView()) 197 - ->setIcon($badge->getIcon()) 198 - ->setHeader($badge->getName()) 199 - ->setSubhead($badge->getFlavor()) 200 - ->setQuality($badge->getQuality()); 201 - $flex->addItem($item); 202 - } 188 + $badge_phids = $user->getBadgePHIDs(); 189 + if ($badge_phids) { 190 + $badges = id(new PhabricatorBadgesQuery()) 191 + ->setViewer($viewer) 192 + ->withPHIDs($badge_phids) 193 + ->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE)) 194 + ->execute(); 203 195 204 - } else { 205 - $error = id(new PHUIBoxView()) 206 - ->addClass('mlb') 207 - ->appendChild(pht('User does not have any badges.')); 208 - $flex = id(new PHUIInfoView()) 209 - ->setSeverity(PHUIInfoView::SEVERITY_NODATA) 210 - ->appendChild($error); 196 + $flex = new PHUIBadgeBoxView(); 197 + foreach ($badges as $badge) { 198 + $item = id(new PHUIBadgeView()) 199 + ->setIcon($badge->getIcon()) 200 + ->setHeader($badge->getName()) 201 + ->setSubhead($badge->getFlavor()) 202 + ->setQuality($badge->getQuality()); 203 + $flex->addItem($item); 211 204 } 205 + 206 + } else { 207 + $error = id(new PHUIBoxView()) 208 + ->addClass('mlb') 209 + ->appendChild(pht('User does not have any badges.')); 210 + $flex = id(new PHUIInfoView()) 211 + ->setSeverity(PHUIInfoView::SEVERITY_NODATA) 212 + ->appendChild($error); 212 213 } 213 214 214 215 $box = id(new PHUIObjectBoxView())